89C51 LED Blink on Breadboard

My First 8051 Microcontroller Project

19th Shaban, 1429 at Queens, NY.

For my first Hello World! project with a microcontroller, I chose to implement an LED blinking circuit. It uses the ATMEL 89C51 (40-pin DIP) microcontroller, which is based on the 8051 architecture and is well-suited for beginners learning about microcontroller chips.

Allah is the Guardian of the believers—He brings them out of darkness and into light.

Quran 2:257

To ensure a stable power supply, I utilized my previously built +5V Regulated Power Supply to provide uninterrupted, regulated DC voltage to the microcontroller.

89C51 LED Blink Schematic
89C51 LED Blink Schematic

To bring the LED blinking project to life, I wrote a simple program in assembly language that runs on the ATMEL 89C51 microcontroller. This program uses a delay loop to create a visible blinking effect on the LED. The delay loop is designed to iterate 65,536 times (255 x 256), creating a software-based delay. Below is the code snippet that accomplishes this task:

ASM
		org		0000h
loop:
		mov		b, #0FFh
		acall		delay
		clr		p1.0
		mov		b, #0FFh
		acall		delay
		mov		p1, #0FFh

		ajmp		loop

delay:
		djnz		acc, delay
		mov		acc, #0FFh
		djnz		b, delay
		ret
end

The video below demonstrates the LED blinking at regular intervals, controlled by the assembly code on the microcontroller.