Text Strings give Syntax Error

Armp

Senior Member
From Manual 2 - pg 6:
Constants can be declared in four ways: decimal, hex, binary, and ASCII.
Decimal numbers are typed directly without any prefix.
Hexadecimal (hex) numbers are preceded with a dollar-sign ($) or (0x).
Binary numbers are preceded by a percent-sign (%).
ASCII text strings are enclosed in quotes (“).
PE seems to accept only single characters?

z2 = "1" is accepted, z2 has value $0031

z2 = "10" gives syntax error...
 

hippy

Ex-Staff (retired)
PE seems to accept only single characters?
That's correct; only single character text strings can be assigned to variables ( the ASCII value of that character is placed in the variable ), however multi-character text string constants can be used within other commands such as SEROUT.
 

Armp

Senior Member
OK - thanks.

As previously stated I'm mapping existing HC11 code into PICAXE, and learning all about the subtle differences!
It's fun....
 

Armp

Senior Member
This is a usable work around for my purpose:

w1= $100* "1"+"0"

w1 is then $3130.

Just makes the code a little easier for me to compare with the original X$ = "10"
 

hippy

Ex-Staff (retired)
Even easier ...

b3 = "1" : b2 = "0"

Or perhaps even better and easier using SYMBOL ...

Symbol w1.lsb = b2
Symbol w1.msb = b3

w1.msb = "1" : w1.lsb = "0"
 
Top