Tut 2 : Blinking LED

A program to blink LED red and green on SK40C board. The delay time is set to 1 second. The blinking will repeat continously.

 
LED and current limiting resistor

LED has two ends an anode and a cathode. Connect it properly to a power supply voltage. The diode will emit light. Depending on any power supply voltage, you need to discard the current through a current limiting resistor to protect LED from burning.

PBP Program

DEFINE OSC 20                                        ' using 20MHz clock oscillator
    @ device hs_osc

loop:  
        High PORTB.6:Low PORTB.7        
        Pause 1000                                          ' Delay for 1 second
        High PORTB.7:Low PORTB.6          
        Pause 1000                                          ' Delay for 1 second
        GoTo loop                                           ' Go back to loop and blink LED forever
        End


Hex Code
2823 01a3 00a2 30ff 07a2 1c03 07a3 1c03
281e 3003 00a1 30e6 200f 2803 01a1 3efc
00a0 09a1 1c03 281a 30ff 0000 07a0 1803
2815 07a0 0064 0fa1 2814 0008 1383 1303
1283 0064 0008 1706 1683 1306 1283 1386
1683 1386 1283 3003 00a3 30e8 018a 2002
1786 1683 1386 1283 1306 1683 1306 1283
3003 00a3 30e8 018a 2002 018a 2823 0063
018a 283f


Schematic diagram from Proteus




No comments:

Post a Comment