PAUSE command

ToggyHead

New Member
Just something that's puzzling me.
I am getting an error when i am trying to use the Pause command in this way:

symbol GlowTime = b0
let GlowTime = 5
pause GlowTime * 1000

Why?
Oh i suspect i am missing something simple but can't find it!:(
 

Technical

Technical Support
Staff member
You can only 'do maths' within let commands.
So try this - note w0 not b0 as the result is 5000

symbol GlowTime = w0
let GlowTime = 5 * 1000
pause GlowTime
 

westaust55

Moderator
Alternatively you may be able to cosider the use of a user defined constant

SYMBOL GlowTime = 5 * 1000
:
:
PAUSE GlowTime​
 

ToggyHead

New Member
Thank you Technical
I was trying to not use words but byte only adding the multiplier but i guess i can't do it :)
I am building a engine controller for a diesel genset and having to deal with lots of timed "actions" i would like to have a table stored on eeprom for all the timing and call 'em when needed. I won't have enough words available... I may try to use fewer word variable and refresh it when needed. After all when the engine is running i don't need to keep the glowing time :)
 

ToggyHead

New Member
Westaust, brilliant!
Somehow i had the impression you have to put your defined constants into variable before processing.... that solve one problem!
Thanks to both of you for the quick answer
 

william47316

New Member
symbol GlowTime =w0
let GlowTime = 5 * 1000
pause GlowTime

FTFY
first the 5000 calculated would exceed the byte variable and wrap around or return 0 etc

second you cant do math in a pause command, thats what you use let (or you can omit let) for

third math is always executed left to right in picaxe land, take this into account when doing slightly more complex math

forth
bytes = 0 to 255 (ie byte variables)
words = 0 to 65535 (two byte variables)
 
Top