8051 Training Kit Programs

 Simple LED ON Program(Inverted Logic)

ORG 0000H

MAIN:

    MOV P2, #00   

SJMP MAIN  

END


Simple LED OFF Program(Inverted Logic)

ORG 0000H

MAIN:

    MOV P2, #ff  

SJMP MAIN  

END


LED Blink 1 Second ON / One Secind Off Blink Program(Without Timers)

ORG 0000H

MAIN:

    CPL P2.0          ; Toggle LED connected to Port 1, Pin 0

    ACALL DELAY       ; Call the 1-second delay subroutine

    SJMP MAIN         ; Repeat indefinitely


DELAY:

    MOV R2, #10       ; Outer loop

OUTER:

    MOV R1, #181      ; Middle loop

MIDDLE:

    MOV R0, #253      ; Inner loop

INNER:

    DJNZ R0, INNER    ; Decrement R0, repeat inner loop if not zero

    DJNZ R1, MIDDLE   ; Decrement R1, repeat middle loop if not zero

    DJNZ R2, OUTER    ; Decrement R2, repeat outer loop if not zero

    RET

END

















Previous Post Next Post