Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20900

BASCOM-AVR : Inkey with case statements that need to start with 0 : REPLY

$
0
0
Inkey returns 0 ( ie Binary zero ) when there is no character in the input buffer. So anytime you enter inkey, and there is no character waiting, you will get 0 as response, hence your case statement always goes to that. If you use buffered serial input, and ischarwaiting, then only go to the inkey statement when ischarwaiting is true ( 1 ), then you will not have this behaviour. And the case where inkey actually returns a binary zero because there is a zero in the buffer is also correctly handled. [code:1:15e143dbe3] dim bt as byte while ischarwaiting() > 0 bt = inkey() select case bt case 0 '' case 1 'and other cases .. end select end while [/code:1:15e143dbe3]

Viewing all articles
Browse latest Browse all 20900

Trending Articles