8051 Development Board
/*
* Project name:
8051 Development Board
* Copyright
(c) Researchdesignlab.com
* Description:
* Test configuration:
MCU: AT89S52
Dev.Board: 8051
Oscillator: 11.0592 MHz
Software: Keil uVision3
*/
#include<reg52.h> //special function register declarations
//for the intended 8051 derivative
void delay(); // Function prototype declaration
sbit LED0=P2^0; //Define Port Pin P2.0 as LED0
sbit LED1=P2^1; //Define Port Pin P2.1 as LED1
sbit LED2=P2^2; //Define Port Pin P2.2 as LED2
sbit LED3=P2^3; //Define Port Pin P2.3 as LED3
sbit LED4=P2^4; //Define Port Pin P2.4 as LED4
sbit LED5=P2^5; //Define Port Pin P2.5 as LED5
sbit LED6=P2^6; //Define Port Pin P2.6 as LED6
sbit LED7=P2^7; //Define Port Pin P2.7 as LED7
void main() //Main Code
{
P2=0x00; //Set Port 2 all bits to 0
while(1) // Continuous loop
{
LED0=1; //Turn ON LED0
delay(); //Wait for a small delay
LED1=1; //Turn ON LED1
delay(); //Wait for a small delay
LED2=1; //Turn ON LED2
delay(); //Wait for a small delay
LED3=1; //Turn ON LED3
delay(); //Wait for a small delay
LED4=1; //Turn ON LED4
delay(); //Wait for a small delay
LED5=1; //Turn ON LED5
delay(); //Wait for a small delay
LED6=1; //Turn ON LED6
delay(); //Wait for a small delay
LED7=1; //Turn ON LED7
delay(); //Wait for a small delay
P2=0x00; //Turn OFF all LED's
delay(); //Wait for a small delay
}
}
void delay() // Delay Routine
{
unsigned int x=60000; // larger the value of x the more is the delay.
while (x--); // executes this statement until x decrements to 0;
}