If statement on 14M

Hooter

Senior Member
Folks - Has anyone had any bother with the If statement on the 14m firmware version 9C?
Code is as follows:

main:
serin 1,N4800,("ABC"),b1
if b1 != 1 then goto Turnonandoff
goto main

Turnonandoff:
Toggle 5
goto main

With b1 I have used both not equal to 1 (!=) and equal to 1 (=) on the simulator and it works as expected.
When I download either program to the 14M they work opposite to what they should.
Ie. When using the Terminal program with the above code, when sending ABC1, it runs through the whole program and toggles the output - and it shouldn't. As it does with ABC2,ABC3 etc.
If however I change it to if b1 = 1 then goto..... absolutely nothing happens. ABC1 wont even toggle the output. Nor will anything else.
What am I missing here.
I am having a Blonde moment.
Any help appreciated
Hooter
 

hippy

Technical Support
Staff member
That's undoubtedly because when you send "ABC1" you are sending the ASCII character "1" ( value 49 decimal, $31 hex ) then comparing it with value 1 decimal, which it won't match.

Change to If b1 = "1" then or != and you'll have more success.
 

Hooter

Senior Member
Thanks Hippy - I thought I had tried all combinations - all sorted now.
Undoubtedly too many bourbons.
Thanks again -
Hooter
 
Top