On Saturday 12 April 2003 12:00 pm, Stephen D. Barnes wrote: > Yup, I'm new to PIC assembly language! > **What am I doing wrong?** > When I compile my code which contains an "IF...ELSE...ENDIF", the > compiler (MPLab ver. 6.10) gives the following error: > > Error[108] E:\PIC\SALLYBOT.ASM 82 : Illegal character (,) > > The line of code it faults on follows (NOTE-the (,) character is > NOT in the code in question as the reported error would suggest). > > if (PB1 == 1) && (PB2 == 1) > > PB1 and PB2 are previously defined variables (portb,5 and > portb,6). No, they're not variables. They're text strings. So your statement looks like: if (portb,5 == 1) && (portb,6 == 1) > I am attempting to test for a condition where both > switches are closed at the same time. I have tried this several > different ways and always get the same error. > Any insights? Beyond this, the "if" statement doesn't do what you think it does. It's a directive to the assembler, *not* something that makes the PIC evaluate a condition. You want to do something considerably less readable: btfsc PB1 goto nope btfsc PB2 goto nope yup: ; both 1 here bra done nope: ; not both 1 here done: -- Ned Konz http://bike-nomad.com GPG key ID: BEEA7EFE -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads