Home > Back-end >  C51 microcontroller programming
C51 microcontroller programming

Time:09-16

This is a c51 microcontroller programming 12 MHZ time 0.5 seconds program,

# include
Char I=100;
Void main ()
{
TMOD=0 x01;
TH0=0 x78;
TL0=0 xec;
EA=1;
P1=0 x00;
ET0=1;//this is enter the interrupt, then interrupt return to execute the next step?
TR0=1;//this timer will start to 0 x78ec input timing?
while(1);//this is not should stop here? How to cycle
{
;
}
}
Void timer0 () interrupt 1
{
TH0=0 xec;
TL0=0 x78;
I -;
If (i<0)
{
P1=~ P1;
I=100;
}
}
  • Related