Input Output Programming of AT89C1051

The following code demonstrate, how to use AT89C1051 to control LED with ON/OFF switch. The code is written in Keil uVision2 IDE and simulation is done with Proteus 8.0. At the end of code, you can find complete project files for download.

Code Using Keil uVision2

#include
// proto-types
void Delayms(unsigned int x_time);
// port pin labling
sbit LED_0 = P1^0;
sbit SW = P3^2;
void main(void)
{
LED_0 = 0; // as output
SW = 1; // as input
while(1)
{
LED_0 = ~SW;
Delayms(10);
}
}
void Delayms(unsigned int x_time)
{
unsigned int x,y;
for(x=0;x<x_time;x++)
for(y=0;y<122;y++);
}

Download Files

For download Keil project and Proteus 8.0 simulation files, click here.

Comments

Popular posts from this blog

How to Program Parallel Slave Port (PSP) in PIC16F877A

How to Program Interrupts in PIC16F877A

How to Program SPI in PIC16F877A (Slave Mode)