Exact match. Not showing close matches.
PICList
Thread
'[PIC]:Please help with compiler error'
2003\04\12@150838
by
Stephen D. Barnes
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).
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?
Regards,
Steve
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
2003\04\12@151413
by
Neil Bradley
> 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)
That's a syntax error (if it's C):
if ((PB1 == 1) && (PB2 == 1))
Is more like it.
-->Neil
-------------------------------------------------------------------------------
Neil Bradley In the land of the blind, the one eyed man is not
Synthcom Systems, Inc. king - he's a prisoner.
ICQ #29402898
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
2003\04\12@151849
by
Ned Konz
|
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
2003\04\12@152306
by
Perhaps you could post the full if-else-endif snippet ?
Error messages can sometimes point to the wrong line, that
is, where the error was detected, not where it was generated.
/Jan-Erik.
Stephen D. Barnes wrote:
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)
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads
More... (looser matching)
- Last day of these posts
- In 2003
, 2004 only
- Today
- New search...