PDA

View Full Version : Bad token error in compile



longpole001
- 18th November 2013, 06:05
Hi guys , not seen this error before but i think i know why it s just dont know how to sort it , what is the best way for this bit of code

1. requirement - build a word consisting of 16 bits of flags ,

aim to store bit flags into the word , pointing to each bit in the word and save the flag as it goes during a for , next loop , where the T points to the bit to be saved

note this just part example ,that generates the bad token error ?


cheers

Sheldon


Fault var word
T var byte

for T = 1 to 16 ' 0 not used so value lines up with correct input sensor number
Fault.(T-1) = 0 ' Clear bit 0 ready for new input during loop - (T-1 ) done to align to bit 0 of fault word varable
next T

HenrikOlsson
- 18th November 2013, 07:06
Hi,
Try this:

for T = 1 to 16 ' 0 not used so value lines up with correct input sensor number
Fault.0[T-1] = 0 ' Clear bit 0 ready for new input during loop - (T-1 ) done to align to bit 0 of fault word varable
next T

For more info, see Melanies writeup. (http://www.picbasic.co.uk/forum/showthread.php?t=544)

/Henrik.

longpole001
- 18th November 2013, 08:26
thanks hendric, thought the T value would be enough , why is not

longpole001
- 18th November 2013, 08:38
ah that was good read , cheers for that hendric , melanies write up was good to review