symbol filler_time = 0
doesn't declare a variable 'filler_time' and set it to zero; it just sets a 'shortcut' called 'filler_time' to a value of zero.filler_time = 30
is trying to set memory location "0" to a value of 30, but using a syntax that isn't allowed - you would have to usepoke filler_time,30
to do that.symbol filler_time = b10
(for example) would let you use filler_time = 30
(and would set b10 to 30)Thanks for your quick reply and answersymbol filler_time = 0
doesn't declare a variable 'filler_time' and set it to zero; it just sets a 'shortcut' called 'filler_time' to a value of zero.
Sofiller_time = 30
is trying to set memory location "0" to a value of 30, but using a syntax that isn't allowed - you would have to use
poke filler_time,30
to do that.
But what you're probably wanting to do, is set up a shortcut to one of the 'named' memory locations (b0->b27) that you can load with a direct 'equate' operation, sosymbol filler_time = b10
(for example) would let you usefiller_time = 30
(and would set b10 to 30)
One tends to use the 'unnamed' memory locations, only when the 'named' ones have been exhausted (because they're a lot less flexible)
It's okay I worked it out.Thanks for your quick reply and answer
Do you mean like this? I tried a few things before seeing your reply and I think it may be what you mean.
symbol filler_time = b0
let b0 =0
if pinC.3 = 0 then
filler_time = 30
endif
if pinC.3 = 1 then
filler_time = 240
endif
Now how can I show on the screen what the value is so that I know it is working properly?
main:
symbol filler_time = b0
let b0 =0
if pinC.3 = 0 then
filler_time = 30
endif
if pinC.3 = 1 then
filler_time = 240
endif
debug filler_time; transmit value to computer screen
pause 5000; short delay
goto main
symbol filler_time = b0
Actually, you see the value enclosed in square brackets, but it is still messy, and not recommended.and might be an unprintable character, in which case you wouldn't see anything for the value
Thanks for that tipMost experienced users will want to use SERTXD to display values to the console: SERTXD ("Filler Time: ",#filler_time,cr,lf)
I tried that and got a syntax error. I found that it works Okay the way I did it. Maybe you have a different method that what I used?Then it is better (and far less confusing) to be consistent and use filler_time throughout, and not switch between b0 and filler_time.
main:
symbol filler_time = b0
let filler_time =0
if pinC.3 = 0 then
filler_time = 30
endif
if pinC.3 = 1 then
filler_time = 240
endif
debug filler_time; transmit value to computer screen
pause 5000; short delay
goto main
symbol filler_time = filler_time
I tried that and got a syntax error.
symbol filler_time = b0 'define what filler_timer referes to
init:
#terminal 9600 'open terminal window
pause 500 'allow terminal to open and connect
filler_time = 0 'initialise to 0
main:
if pinC.3 = 0 then 'if pinc.3 is low, then filler_time is 30
filler_time = 30
endif
if pinC.3 = 1 then 'if pinc.3 is high then filler_time is 240
filler_time = 240
endif
sertxd (#filler_time, 13, 10)
pause 1000 'hold here for 1 second
goto main