A Simple LED Blinking using Keil uvision and Proteus
Here I am using a single LED which is connected to Port 1 of microcontroller.
I am using 8051 microcontroller - AT89C52 with crystal frequency of 11.0592 MHz.
First let us design our circuit in Proteus ISIS and then we will go for our code to the microcontroller in Keil uvision.
Code:
#include<reg51.h>
sbit x = P1^0;
// function declarations
void init(void); // initialization
void delay(int a); // delay
// main function
void main(void){
init(); // init function call
while(1){
x = 0;
delay(30000);
x = 1;
delay(30000);
}
}
void init(void){
P1 = 0x00; // initializing Port 1 pins to 0
}
void delay(int a){
int i;
for(i=0; i<a; i++);
}
Comments
Post a Comment