Bad token error in compile


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Exclamation Bad token error in compile

    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
    Code:
    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

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,604


    Did you find this post helpful? Yes | No

    Default Re: Bad token error in compile

    Hi,
    Try this:
    Code:
    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.

    /Henrik.

  3. #3
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Bad token error in compile

    thanks hendric, thought the T value would be enough , why is not

  4. #4
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Bad token error in compile

    ah that was good read , cheers for that hendric , melanies write up was good to review

Similar Threads

  1. compile error - bad BANK statement
    By longpole001 in forum General
    Replies: 2
    Last Post: - 8th December 2012, 05:51
  2. Compile Error
    By longdw in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd March 2010, 16:04
  3. Compile error & syntax error on the word "loop:" as a label?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th March 2010, 04:14
  4. bad expression error, linking addresses incorrectly.
    By robertpeach in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th August 2009, 13:04
  5. Bad Token with LCDout
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th February 2006, 17:43

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts