Variable assignments / bits

adumas

Member
Two very quick - simple questions.


'*****************************************************
; set picaxe type
#picaxe 28x1

Symbol x b1
Symbol y b2
Symbol FileName = w2

FileName = "tempdat.txt"
'*****************************************************
Why is assigning FileName this string illegal?

I don't want to hard code this string in my program: how can I assign it to a variable?

What is the correct way to do this?

Secondly,

How can I do something like:

x=%10101010

y=x.bit3 'assigning the value of 1 to y

Appreciate the help
 

hippy

Technical Support
Staff member
Why is assigning FileName this string illegal?

PICAXE variables are 1-bit, 8-bit or 16-bit integer variables. There are no string variables.

I don't want to hard code this string in my program: how can I assign it to a variable?

You cannot.

How can I do something like: y=x.bit3

y = x & %00001000 MAX 1

or, if you can move 'x' into variable 'b0'

b0 = x
y = bit3

There are a few other ways to do it as well.
 
Top