You are on page 1of 2

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

Program: Code:
; ; ; ; ; ; First Program, Flash an LED at P1.0 www.8051projects.info Hardware Notes: AT89C51 Running at 12 MHz P1.0 is the LED (to light, it is pulled down) ORG 00H CPL P1.0 ACALL DELAY AJMP FLASH ; Execution Starts Here ; Turn on/off the LED ; call one second delay ; repeat forever

FLASH:

DELAY: REPEAT:

MOV R1,#0FFH MOV R2,#0FFH DJNZ R2,$ DJNZ R1,REPEAT RET END

You might also like