PDA

View Full Version : "Incorrect Symbol - W1"



rbwilliams
04-11-2008, 21:49
Hello,
I am relatively new to Picaxe. So please be patient.

Can anyone explain to me why these lines don't compile with a 28X1 selected?

code/
symbol SYMBOL1 = w1
symbol SYMBOL2 = 65536 - t1s_16
symbol SYMBOL3 = SYMBOL2 / SYMBOL1
symbol SYMBOL4 = 65536 - SYMBOL3
/code

Thanks,
Roger

picaxester
05-11-2008, 01:21
Are you using Linux?
Because for some risen it doesn't like the character "0D".
I had to use a hex editor to remove them from the programs that I make using Windows.

BCJKiwi
05-11-2008, 01:22
The answer is fairly straight forward - you can't do math in a symbol declaration!

The manual says;
Symbols
Symbols can be assigned to constant values, and can also be used as alias names
for variables (see Variables overleaf for more details). Constant values and
variable names are assigned by following the symbol name with an equal-sign
(=), followed by the variable or constant."

A mathematical expression is not a constant or a variable name.

Well I stand corrected! - Live and Learn as they say!

hippy
05-11-2008, 10:35
Maths operators can be used within SYMBOL but the issue here is in trying to use a variable (w1) as a constant ...

symbol SYMBOL1 = w1
symbol SYMBOL3 = SYMBOL2 / SYMBOL1

westaust55
05-11-2008, 21:04
Can this fact that math can be done within a SYMBOL statement be added to Manual 2 at page 6 on the topic "Symbols" in the next revision

hippy
06-11-2008, 12:32
It's described in manual 2 on Page 173 under SYMBOL command but point noted.