Mohammad

Robotics Blog

RECENT POSTS

TWITTER UPDATES

No public Twitter messages.

The First 8051 Microcontroller Project – LED Blinking

Posted by Mohammad On August - 20 - 2008 14 COMMENTS

The first “Hello World!” project I prefer for Microcontroller is LED Blinking. I have used ATMEL’s 89C51 (40-pins DIP) 8051 architecture microcontroller which is ideal for first time learning MCU Chip. I used my previously made 5V Regulator to supply uninterrupted regulated DC voltage. The program is very simple and straight forward, that uses a delay procedure that loops for 255 x 256 = 65536 times and produce loop based software delay.

		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

VN:F [1.9.13_1145]
Rating: 8.0/10 (8 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
The First 8051 Microcontroller Project – LED Blinking, 8.0 out of 10 based on 8 ratings

14 Responses

  1. athar says:

    goood project for learning

    VA:F [1.9.13_1145]
    Rating: 5.0/5 (1 vote cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  2. anshuman says:

    how do you connect the microcontroller with the pc.

    VA:F [1.9.13_1145]
    Rating: 5.0/5 (1 vote cast)
    VA:F [1.9.13_1145]
    Rating: +1 (from 1 vote)
  3. tyler says:

    hi.i interest about MCS-51.Your project LED Blinking by 8051 it very easy.
    Thank you for example.maybe u have free time.
    Thank You.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: +1 (from 1 vote)
  4. Binu says:

    Good start!

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  5. deena says:

    goooooooooddd..

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  6. nasir says:

    do you have an example to blinking 7 led sir?
    i need a circuit and the source code also..
    perhaps the source code is using keil uversion and 8051 microcontroller..

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  7. Doru says:

    Hi there. I have a simple project for school. I need to connect a 8051 to a 7 segment lcd and to make a counter. Basically once every 2 seconds the display should increment with i(where i is a value that can be set from the assembly code). When it reaches 10 it should overflow and start over.

    I need to simulate this in proteus.

    Please help me. I will be forever grateful.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  8. Prithviraj says:

    But how do you program the 8051? serial or ISP?? please give the programming circuit sir…..thank you…..

    VA:F [1.9.13_1145]
    Rating: 1.0/5 (1 vote cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  9. Sajiv says:

    Good for beginners. :)

    VA:F [1.9.13_1145]
    Rating: 4.0/5 (1 vote cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  10. gaurav singh says:

    sir
    is this possilbe to connect led + terminal to the mcu and – to the gnd

    will the mcu draw enough couurent to blink the led

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  11. rashmi chauhan says:

    HI Sajiv

    this is good for beginers ,good job

    check out this blog for 8051 usb programmer schematic

    http://microembeded.blogspot.com/2011/06/usb-8051-avr-microcontroller-programmer.html

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  12. Mohammad says:

    @Gaurav Singh: You can do it too, but add a current limiting resistor in series to make sure the current through the LED doesn’t go above 25-30mA.

    VN:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  13. Daljit says:

    sir please tell me why led is blinking on clear and off when set…???why??plz answer me m so confused

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)
  14. Mohammad says:

    @Daljit: Simple math. Do you see the right side (+) of the LED is connected to VCC (+5V)? Now if you ground (0V) the other side, LED will lit.

    VN:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VN:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply