This program blinks an LED connected to port 2 by toggling the port between 255 and 0, with delays between each change implemented by nested loops that count down registers R4 and R5. It does this continuously by short jumping back to the beginning in an infinite loop.
This program blinks an LED connected to port 2 by toggling the port between 255 and 0, with delays between each change implemented by nested loops that count down registers R4 and R5. It does this continuously by short jumping back to the beginning in an infinite loop.
This program blinks an LED connected to port 2 by toggling the port between 255 and 0, with delays between each change implemented by nested loops that count down registers R4 and R5. It does this continuously by short jumping back to the beginning in an infinite loop.
ORG 0000H /*Starting address, to indicate the beginning of the address */
AGAIN: MOV A,#0FFH /* Move 255 to Accumlator*/
MOV P2,A /* Move that data to Port 2*/ ACALL DELAY /* Call delay */ MOV A,#00H /* Move 0 to Accumlator */ MOV P2,A /* Move that data to Port 2*/ ACALL DELAY /* Call Delay */ SJMP AGAIN /* Short Jump to Again */
DELAY: MOV R5,#05FH /* move 5fh data to Temp Register */
L2: MOV R4,#0FFH /* move ffh data to Temp Register */
L1: DJNZ R4, L1 /* Decrement R4 and Jump if not equal to zero to L1 */ DJNZ R5, L2 /* Decrement R5 and Jump if not equal to zero to L2 */ RET /* Return to main program */ END /* End Program */