Program For Led Blink Microcontroller

Active3 years ago

LED Blinking using 8051 Microcontroller and Keil C – AT89C51. By Ebin George 8051 Microcontroller. EA should be strapped to VCC for internal program executions. PIC16F877A LED Blinking Program Reply to Thread. Discussion in 'Programmer's Corner. 1 Next > Jul 8, 2012 #1. ActivePower Thread Starter Active Member. Mar 15, 2012 155 23. I am a complete noob in programming a PIC microcontroller and I have been trying to get the most basic of the tasks (flashing an LED) done. Then I rebuilt my LED.

This is my first attempt at programming in assembly and I can't figure out what is the wrong with this below code because it doesn't work properly.

Jean-François Fabre
111k10 gold badges71 silver badges126 bronze badges
dfdopulledfdopulle

1 Answer

Problems are in double loops:

The first goto is skipped when COUNT1 is zero. But then you go to the second loop, which 'reloads' the loop. You have an infinite loop here.

I don't know how COUNT1 is initialized, but it doesn't matter. I would do that.

Arduino

of course, same thing for Loop2. I would even suggest that you do a subroutine that you call twice instead of copying/pasting.

very suprising assembler where conditions can skip the next instruction:

Jean-François FabreJean-François Fabre
111k10 gold badges71 silver badges126 bronze badges
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.

Not the answer you're looking for? Browse other questions tagged assemblymicrocontrollerpic or ask your own question.


Led Blink Program


Hello friends, hope you all are fine and having fun with your lives. In today’s tutorial, we will see LED Blinking Project Using 8051 Microcontroller. I haven’t yet posted any project or tutorial on 8051 Microcontroller. I have posted quite a lot of tutorials on Arduino and PIC Microcontroller, so today I thought of posting tutorials on 8051 Microcontroller. Its my first tutorial on it and I am gonna post quite a lot of tutorials on 8051 Microcontroller in coming week.

So, as its our first tutorial on 8051 Microcontroller that’s why its quite a simple one and as we did in Arduino we will first of all have a look at LED Blinking Project Using 8051 Microcontroller. In this project, we will design a basic circuit for 8051 Microcontroller which involves crystal oscillator etc. The basic circuit of 8051 Microcontroller is quite the same as we did for PIC Microcontroller. After that, we will attach a small LED on any of its I/O pins and then will make it blink. I have also given the Proteus Simulation along with Programming code designed in keil uvision 4 for download at the end of this post. So, let’s get started with it. 🙂

Program For Led Blink Microcontroller

LED Blinking Project Using 8051 Microcontroller in Proteus ISIS

  • I am gonna first design the simulation of LED Blinking Project using 8051 Microcontroller in Proteus ISIS, as you all know Proteus is my favorite simulation software.
  • After designing the simulation, we will design the programming code for 8051 Microcontroller.
  • In order to design the code we are gonna use Keil micro vision compiler and the version I have rite now is 4. So its keil micro vision 4 compiler for 8051 Microcontrollers.
  • So let’s first design the Proteus Simulation for LED Blinking PRoject Using 8051 Microcontroller.
Blink
Proteus Simulation for LED Blinking Project
  • So, get these components from Proteus components library and place it in your workspace, these components are shown in below figure:
  • So, now I hope you have got all these components, now design a circuit in your Proteus software as shown in below figure:
  • Now you can see in the above image, I have used crystal oscillator of 16MHz which is used to provide frequency to 8051 Microcontroller.
  • After that we have placed a 10k resistance in path of our Reset pin.
  • LED is connected to first pin of Port 1 which is P1.0.
  • So, now let’s design the programming code for 8051 Microcontroller as we are done with the Proteus Simulation.
Keil Programming Code for LED Blinking Project

C Program For Led Blinking

  • Now as I have mentioned earlier, the compiler I have used for designing the programming code for LED Blinking Project is Keil micro vision 4.
  • So I hope you have this installed on your computer and if not then must install it as otherwise you wont be able to compile this code, but I have also placed the hex file so that you can run the simulation easily.
  • You can download them easily by clicking the Download buttons present at the end of this post.
  • So now create a new project in your keil compiler and paste the below code in your c file.
  • Now let me explain this code a bit, first of all, I declare the pin1.0 as LED so that its easy to use it in our code in future.
  • After that I declared two functions. One of them is the delay function which is just adding the delay, while the second function is for initialization of Port 1 as output port.
  • While in the Main function, we have used the LED blinking code in which LED is ON and then OFF continuously and so that make it blink.
  • Now after adding the code in your Keil software, compile it and get the hex file.
  • Upload this hex file into your 8051 Microcontroller which I have used is AT89C52 and hit the RUN button.
  • If everything’s goes fine then you will get results as shown in below figure:

Program For Led Fan

  • Now click the below button to get the simulation and the programming code and let me know did it work for you. 🙂
Download Proteus Simulation & Keil Code

8051 Microcontroller Programs

That’s all for today, will come soon with new tutorial on 8051 Microcontroller so stay tuned and have fun. Cheers !!! 🙂


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Category: 8051 Microcontroller ProjectsBy

Program For Led Blink Microcontroller Software

Syed Zain Nasir7 Comments

Arduino Program For Led

Author: Syed Zain Nasir

https://www.theengineeringprojects.com/I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>