Write an Embedded C program to blink the alternate LEDs in Port 3
#include<at89x51.h>  
void cct_init(void);
void MSDelay(unsigned
int);
void main(void)
{
 while(1)
 {
  P3=0x55;
  MSDelay(50);
  P3=0xAA;
  MSDelay(50);
 }
}
void cct_init(void)
{
P0 = 0x00;   
P1 = 0x00;   
P2 = 0x00;   
P3 = 0x00;  
}
void MSDelay(unsigned
int itime)
 {
 unsigned int i,j;
  for(i=0;i<=itime;i++)
  for(j=0;j<=1275;j++);
 }

0 comments:
Post a Comment