Error: extra tokens on end of line
After accidentally toggling the breakpoint feature or clicking something in Microcode studio, all of a sudden I get random error messages when compiling. Most of them are:
[201] ')' expected
[212] extra tokens on end of line
[300] too many errors
If I just start remming out lines, at some point, it will assemble properly. If I rem out one line and then un-rem another suspect line, it still complies OK. I've written other apps with IF...THENs this deep and had no problem. The code on most of the lines are identical except for the values.
This one really has me stumpped. About 6 months ago, I patched to MicroCode Studio 2.3.0.0 and the compiler is PICBASIC PRO 2.47. This is for 16F877A.
Is there a setting in MicroCode Studio that could have been changed that is causing this?
At one point I had this code working fine and then I added one IF-THEN to add a feature and then it wouldn't compile. I took the code out so it would be back to original and it still wouldn't compile.
I would appeciate any ideas as to what could cause this...
Here is the code...
CCP1CON = 0
CCP2CON = 0
adcon1 = 6
trise = 7
trisc = 191
porte = 0
trisa = 255
trisb = 0
trisd = 255
portEval var byte
portCval var byte
portCfinval var byte
stripBit var bit
portDval var byte
portAval var byte
IdNumber var byte
OutVal var byte
DEFIne HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
define HSER_SPBRG 25
BtVar var byte
portb = 0
START:
stripbit = portc.0 'this strips off the first 6 bits of port C
portcfinval.0 = stripbit 'to use as inputs, while ignoring the RX and TX pins.
stripbit = portc.1
portcfinval.1 = stripbit
stripbit = portc.2
portcfinval.2 = stripbit
stripbit = portc.3
portcfinval.3 = stripbit
stripbit = portc.4
portcfinval.4 = stripbit
stripbit = portc.5
portcfinval.5 = stripbit
if porta <> portaval then
portaval = porta
hserout [#porte,"A",#porta,13,10] 'the code that the PC recieves has the ID code,
endif 'the port letter and port value
if portd <> portdval then
portdval = portd
hserout [#porte,"D",#portd,13,10]
endif
if (portcfinval <> portcval) then
portcval = portcfinval
hserout [#porte, "C", #portcfinval, 13,10]
endif
hserin ,100,start,[Idnumber]
porteval = porte 'here is the code that I added
if idnumber = porteval then 'port E is the ID code or the chip
HSERIn ,500,START,[Btvar] ' the chip only responds to serial
else 'commands that match the ID code
goto start 'this lets more than one chip operate in parrallel on
'one serial port
endif '
if btvar = 48 then
HSERIn ,1000,START,[btvar]
if btvar = 48 then outval.bit0 = 0 'turn on/off bit on port b with serial command from
if btvar = 49 then outval.bit0 = 1 'PC
portb = outval
goto start
endif
if btvar = 49 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit1 = 0
if btvar = 49 then outval.bit1 = 1
portb = outval
goto start
endif
if btvar = 50 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then Outval.bit2 = 0
if btvar = 49 then outval.bit2 = 1
portb = outval
goto start
endif
if btvar = 51 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit3 = 0
if btvar = 49 then outval.bit3 = 1
portb = outval
goto start
endif
if btvar = 52 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit4 = 0
if btvar = 49 then outval.bit4 = 1
portb = outval
goto start
endif
if btvar = 53 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit5 = 0
if btvar = 49 then outval.bit5 = 1
portb = outval
goto start
endif
if btvar = 54 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit6 = 0
if btvar = 49 then outval.bit6 = 1
portb = outval
goto start
endif
if btvar = 55 then
HSERIn ,1000,START,[Btvar]
if btvar = 48 then outval.bit7 = 0
if btvar = 49 then outval.bit7 = 1
portb = outval
goto start
endif
goto start