Home > other >  51 microcontroller running water light C language version
51 microcontroller running water light C language version

Time:09-18

# include "reg52. H"
Typedef unsigned int under-16;
# define led P1



Void delay (under-16 I) {
while(i--);
}
Void main () {
Under-16 I;
Led=0 xfe;
Delay (100);
While (I) {
for(i=0; I<8; I++) {
P1=(0 xfe & lt; Delay (100);
Delay (100);
}}}
Just started to learn, also can't write, have bosses can help have a look at this program have mistake, thank you

CodePudding user response:

While (I) in the bracket is supposed to be 1, is not I,

CodePudding user response:

reference 1st floor xuyaqi029 response:
while (I) in the bracket is supposed to be 1, is not I,

If I can,, it is not infinite loop

CodePudding user response:

"51 single chip microcomputer project tutorial" xian-feng wu editor that Ben? Read a lot of things didn't say understand, only know that it can be lit LED lights, but why do you write, made no mention in the book!

CodePudding user response:

1 if the direct use of p1 need not define led, defines the led is used led
2 main function cycle use Numbers 1 presentation logic 0 presentation logic really not
3 cycle timing seems to destroy short frequency fast can see light
4 cycle stopped after 8 times no longer cycle
5 the while (1) original, even if a loop body does not need to write cycle if judgment control again can you might as well tell me about this, of course, belongs to the advanced category

CodePudding user response:

6 cycle only eight times without using variable of type 16.
  • Related