-->

LED Blinking Using 8051

By
--> LED Blinking Using 8051 -Proteus Simulation Tutorials
AT89C51 is an 8-bit micro-controller and belongs to Atmel's 8051 family. AT89C51 has 4KB of Flash programmable and erasable read only memory (P-EROM) and 128 bytes of RAM. It can be erased and program to a maximum of 1000 times.

In 40 pin AT89C51, there are four ports designated as P1, P2, P3 and P0. All these ports are 8-bit bi-directional ports, i.e., they can be used as both input and output ports. Except P0 which needs external pull-ups, rest of the ports have internal pull-ups. When 1s are written to these port pins, they are pulled high by the internal pull-ups and can be used as inputs. These ports are also bit addressable and so their bits can also be accessed individually.

Port P0 and P2 are also used to provide low byte and high byte addresses, respectively, when connected to an external memory. Port 3 has multiplexed pins for special functions like serial communication, hardware interrupts, timer inputs and read/write operation from external memory. AT89C51 has an inbuilt UART for serial communication. It can be programmed to operate at different baud rates. Including two timers & hardware interrupts, it has a total of six interrupts.

One can read datasheets for detailed knowledge.

Lets start with our first program to blink the LED's at the PORT-0 of the Micro-Controller.
Note that these programs are made in Keil u Vision 3
-->

#include <REGX51.H> // Header file

void Delay(unsigned char i); // Function calling

void main()

{
P0 = 0x00;                               //PORT 0 as Output Port


while (1) {

P0 = 0xAA;                           // 10101010

Delay(1000);

P0 = 0x55;                           // 010101010

Delay(1000);

}
}

void Delay(unsigned char itime)

{

unsigned char i;

for (i = 0; i < itime; i++);

}

  1. Now put the generated *.hex files in the micro-controller's memory and view the result, the output is shown below.
Any doubt Please mail me i will help you thannara123(at)gmail.com

More Posts

gElectron. Powered by Blogger.

Contributors

16x2 LCD Interfacing with STM32,STM32F103C6

 16x2 LCD  Interfacing with STM32,STM32F103C6 lcd_init(); LCD_LINE1; lcd_String(" GeElectron"); LCD_LINE2; lc...

Contact Form

Name

Email *

Message *

Contact us

Name

Email *

Message *

Follow Us

https://www.facebook.com/gElectron-393939667321867/ FBbox/https://www.facebook.com/IVYthemes

Comments

[blogger]

MKRdezign

Test
google.com, pub-8429441124104529, DIRECT, f08c47fec0942fa0
[blogger]

Latest

[recent][newsticker]

Technology

Top Ads

RECENT COMMENTS

Subscribe Via Email

Subscribe to our newsletter to get the latest updates to your inbox. ;-)


Your email address is safe with us!

RECENT COMMENTS