Hello all,
I've got my serial comms working great, thanks to all of you! As I'm running my code through the sim, I'm trying to validate the incoming decimal address, with no success. It goes something like this:
Code:
hserin [wait("A"),DEC3 boardadd]
hserout ["Board received A",DEC3 boardadd,13,10]
IF (boardadd = 000) OR (boardadd > 254) THEN 'THIS IS NOT WORKING!!!!!
hserout ["Error: Address ",DEC3 boardadd," not valid! Please use 001 to 254.",13,10]
else
write 0,boardadd
high Progled
pauseus 50
low progled
read 0,boardaddep
hserout ["Board address set to ",DEC boardaddep,13,10]
endif
The "=000" works, but the ">254" doesn't. The code allows me to enter >254. Am I missing something here, or am I trying to compare 2 different formats? I've tried the following with no success:
IF (DEC3 boardadd = 000) or (DEC3 boardadd > 254) THEN...
Hope one of you can help. Thanks a million!
C
Bookmarks