Tex, many thanks for the suggestion. I was aware of what these are, and I use them in a similar fashion, but I hadn't thought of looking at them in the code explorer!Page 16 of PICAXE Manual 2 "Basic Commands" -
www.picaxe.com/docs/picaxe_manual2.pdf
For the M2's -
s_w0 - task - current task (during parallel processing)
s_w7 - time - elapsed time
The rest are 'reserved for future use'.
The 's_wX' variables are not split into individual byte variables, are solely word variables.
Thanks, hippy. You answered my question as to whether these are split into byte variables. It's interesting to see that, in PE6 using the code explorer under the system variable, they only show up as 8 bit bytes. I ran a quick simulation, and while the decimal value indeed increments all the way to 65535, the binary 8 bit byte goes blank at 255. The memory map shows nothing.Page 16 of PICAXE Manual 2 "Basic Commands" -
www.picaxe.com/docs/picaxe_manual2.pdf
For the M2's -
s_w0 - task - current task (during parallel processing)
s_w7 - time - elapsed time
The rest are 'reserved for future use'.
The 's_wX' variables are not split into individual byte variables, are solely word variables.
Yes, I also find them useful in subroutines, etc.. But beware that, at least in PE5 and/or the simulator, there are some bugs if bytes are involved. I don't recall the full details now, but for example the following behaves differently in the simulator (6.0.9.3) for w5 and s_w5.The 's_wX' variables are not split into individual byte variables, are solely word variables.
[color=Blue]symbol [/color][color=Purple]value [/color][color=DarkCyan]= [/color][color=Purple]s_w5[/color]
[color=Blue]write [/color][color=Navy][b]0[/b][/color][color=Black], [/color][color=Navy][b]12[/b][/color][color=Black],[/color][color=Navy][b]34[/b][/color]
[color=Blue]read [/color][color=Navy][b]0[/b][/color][color=Black], [/color][color=Blue]word [/color][color=Purple]value[/color]
[color=Blue]sertxd([/color][color=Black]#[/color][color=Purple]value[/color][color=Blue])[/color]
Pause 2000
; Initialise to 0
s_w1 = 0
Write 0, Word s_w1
; Read back that zero
s_w1 = 12345
Read 0, Word s_w1
SerTxd( "Rst", TAB, #s_w1, CR, LF ) ; Shows 0
; Write a value
s_w1 = 54321
Write 0, Word s_w1
SerTxd( "Set", TAB, #s_w1, CR, LF ) ; Shows 54321
; Read what was written
s_w1 = 12345
Read 0, Word s_w1
SerTxd( "Now", TAB, #s_w1, CR, LF ) ; shows 54321
End