Flashing an LED
This section describes how to interface an LED to the microcontroller AT89C51/52 to flash.
The circuit explains how to connect an LED to the Microcontroller, the program to flash an LED connected to port 1.4 using the CPL instruction
; First Program, Flash an LED at P1.4
; EXCEL Technologies
;
; Hardware Notes:
; AT89C51 Running at 12 MHz
; P1.4 is the LED (to light, it is pulled down)
ORG 00H ; Execution Starts Here
FLASH: CPL P1.4 ; Turn on/off the LED
ACALL DELAY ; call one second delay
AJMP FLASH ; repeat forever
DELAY: MOV R1,#0FFH
REPEAT: MOV R2,#0FFH
DJNZ R2,$
DJNZ R1,REPEAT
RET
END