Shop OBEX P1 Docs P2 Docs Learn Events
programming error — Parallax Forums

programming error

RobbanRobban Posts: 124
edited 2007-02-04 11:23 in BASIC Stamp
Hi!
have written this program and i get "undefined symbol on the "rpm=010C line"" when i try to send it to the BS2
Why?
what shall i write instead?

' {$STAMP BS2}

rpm············ VAR···· Word················ ' RPM VAR
rpmD··········· VAR···· Word················ ' Final data
rpm = 010C································· ' ECU Code for RPM

readRPM:
DO
· SEROUT 16, 84, [noparse][[/noparse]HEX rpm]·················· ' Send ECU Data Request( Correct baud is SEROUT 16, 32)
· SERIN 16, 84, [noparse][[/noparse]HEX2 rpm]················· ' Waiting for ECU data
· rpmD = rpmD */ $1F19······················ ' Multiply by 31.25
·SEROUT 0,84,[noparse][[/noparse]DEC rpmD]························· ' Debug for display
LOOP
END

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-02-04 11:23
    Robban -

    It should be almost self-evident from similar usage elsewhere in your program. If you want to use HEXADECIMAL (0-F) notation, you must tell the PBASIC Editor you are doing so, by preceeding the constant with a $ as follows:

    rpm = $010C

    If you want to use BINARY notation (0-1) then you need to preceed the constant with a % sign as follows:

    Is_OFF = %00000000
    Is_ON = %11111111

    Without any preceeding type designator before a constant, DECIMAL (0-9) notation is presumed. You implied you were using DECIMAL since there is no preceeding type designator. This would permit the numerals 0-9 BUT you have specified numerals from the HEXADECIMAL number set (0-F), thus the confusion.

    This and similar topics are covered in the PBASIC Reference Manual and the PBASIC Help File under the heading "Constants and Variables".

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
Sign In or Register to comment.