PDA

View Full Version : Where am i going wrong?



sphinxifm
- 13th April 2008, 14:53
Hi again all.
Many thanks for your previous help. Below i have listed my serin code and it reads the ir and works well except for it does not jump to the listed label after the timeout. I know its probably obvious but ive been staring at the code for hours and cant see where im going wrong, could anyone please advise me on why?

IRIN:
Serin portb.0,N2400,200,TOUT,B0 ' B0 = input character
If (B0 = "A") or (B0 > "0") Then call IRHIT ' If lower case, convert to upper
goto IRIN


IRHIT:
high portc.0
goto GAMEEND

TOUT:
high porta.6
pause 5000
low porta.6

This is only a section of my overall code but it is as far as i can see the only part that has anything to do with the serin part of the program.
After i have completed the program i will post the full code and circuit schematics.

paul borgmeier
- 13th April 2008, 15:32
>> If (B0 = "A") or (B0 > "0") Then call IRHIT ' If lower case, convert to upper

without seeing more, try

If (B0 = "A") or (B0 > "0") Then IRHIT ' If lower case, convert to upper

sphinxifm
- 13th April 2008, 17:22
thankyou for your suggestion. i tried it but it didnt change a thing. The program is supposed to jump to TOUT after 200ms if it doesnt recieve a valid serial command. any help or suggestions would be great. Ive checked the pbp manual but it shows the command how ive written it but i am getting no joy.
thanks in advance for all help.

mister_e
- 13th April 2008, 19:24
Most problem with timeout is the Idle state of your Serial PIN. If it doesn't match, it will never execute the Timeout.

What you can do, is to leave your serial pin floating, test it with a pull-up, then pull-down... see which one allow Timeout to work. Inverted mode should idle low. True mode should idle high.