PDA

View Full Version : Button stops when i use Serin



SuB-ZeRo
- 8th July 2005, 13:43
loop:
button porta.4 ,0,0,0,b1,1,show 'AND I CAN'T GET THE BUTTON PUSH
serin portb.1,4,B0 'IF I USE THIS COMMAND THE PROGRAM STOPS HERE
if b0=1 then goto ok
goto loop

It is a simple code.If other pic sent data "1" then other pic will show with led
but when i use serin command program stops and wait data "1" and when program stops i cant get the button commands if i remove serin command the program works well but i need serin command coz i want to use remote.

Any suggestion?

Dwayne
- 8th July 2005, 14:19
but when i use serin command program stops and wait data "1" and when program stops i cant get the button commands if i remove serin command the program works well but i need serin command coz i want to use remote

You are stuck on your SerIn statement... It is waiting for input...You need to use a timeout on your SerIn...I can't remember if SerIn has a timeout, but I do know that SerIn2 does... Or you can use a interupt on your Button, instead of a scanpin...Or you can use a interupt on your SerIn routine.

Dwayne

Dwayne
- 8th July 2005, 14:35
Serin does have a timeout.


SERIN Pin,Mode,{Timeout,Label,}{[Qual...],}{Item...}

Thus your Serin needs a timeout of about 100 milliseconds (or whatever you deep necessary, and a label for it to jump to, (In your case, the label is "Loop")

Dwayne