PDA

View Full Version : programming error



Robban
02-04-2007, 06:11 PM
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, [HEX rpm]·················· ' Send ECU Data Request( Correct baud is SEROUT 16, 32)
· SERIN 16, 84, [HEX2 rpm]················· ' Waiting for ECU data
· rpmD = rpmD */ $1F19······················ ' Multiply by 31.25
·SEROUT 0,84,[DEC rpmD]························· ' Debug for display
LOOP
END

Bruce Bates
02-04-2007, 07:23 PM
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 -->