Home > other >  This problem bothering me for a long time and take it out to discuss
This problem bothering me for a long time and take it out to discuss

Time:10-14

Is programming of single chip microcomputer buttons, others write programs,
Is this:
Sbit key=P2 ^ 5;
Bit key_error=0;
If (key_error & amp; & Key)
{
delay_ms(10);
If (key)
{
Execute statement;
}
}



When the button pressed, P2 ^ 5 grounding, my question is on the if the judgment of the conditions, key_error & amp; & What is the result of the key?

My understanding is:
Key_error=0;
Button press key also to 0,
Lust after the result is 0,
Namely the if (0 & amp; & 0),
So do not perform the following statement!

I think if the judgment of the conditions should be like this:
If (key_error==0 & amp; & Key==0)
If (key==0)
Just say pass!


But if (key_error==0 & amp; & Key==0) and the if (key_error & amp; & Key), the difference is very big still, heck is wrong with son

Also please bosses some directions,

CodePudding user response:

The building Lord you understand is right

CodePudding user response:

Key_error and see if it is in other places have changed, this here is most meaningful, such as can do a gate, let go, to test key
Look at this a few words in fact don't see what, according to the passage, in order to know the process if you have any questions

CodePudding user response:

Cannot be taken out of context, if someone else is written like that, it must be useful, and the establishment of the judgment condition must be 2 to 1 conditions was established, perhaps his buttons do not connect power grounding unknown?

CodePudding user response:

CKC quote 2 floor response:
key_error and see if it is in other places have changed, this here is most meaningful, such as can do a gate, released to detect key
Look at this a few words in fact don't see what, according to the passage, do you have any questions to know the processing

Thank you for your reply, I have to have a good look at the code

CodePudding user response:

reference 3 floor wise men know already should good karma response:
cannot be taken out of context, if someone else is written like that, it must be useful, and the establishment of judge conditions must be 2 to 1 condition was established, perhaps his buttons do not connect power grounding unknown?

Thank you for your reply, I have to have a good look at the code
  • Related