Home > other >  Look not to understand AT8951 microcontroller program
Look not to understand AT8951 microcontroller program

Time:10-04

#include
Unsigned char s1=0, s2=0;
Unsigned char code table []=
{
X50 x05 0, 0 x0a, 0, 0 xa0, 0 x55, 0 xaa, 0 XFF, 0 x00
};
Void main ()
{
TMOD=(TMOD& 0 x0f) | 0 x10;
TH1=0 x3c;
TL1=0 xb0;
EA=1;
ET1=1;
TR1=1;
While (1)
{
P1=table (s2);
}
}
Void t1 (void) using interrupt 3 0
{
S1 + +;
If (s1==20)
{
S1=0;
S2 + +;
S2=s2 & amp; 0 x07;
}
}
Big help explain?

CodePudding user response:

Configuration timer 1 pattern for the first 1 is a 16-bit timer, timer time is 65536-0 x3cb0=40000 40 ms, namely when the timing to meet 20 times the 0.8 s to replace to output to the p1 mouth level signal,

CodePudding user response:

Instead of 40 to 50 ms, total time 1 s changed after it has been a port output level

CodePudding user response:

Inside the main function of the first three sentences is to configure the size of the timer mode and, if may have to you can consult books, under the SCM beginners book, EA, ET1, TR1 hadn't misremember interrupt is open, and open the interrupt flags, you perform in the death cycle is P1 mouth output data, according to your assignment in the S2, running water light should be! A shot in the dark . As for interrupt3 is that your interrupt program, your operation here is internship switching table array index number,
51 haven't touch for a long time, can't remember, register you beginners can read the register, so learn faster and understand more quickly, just a personal opinion
  • Related