Using System Variables

SAborn

Senior Member
When using System Variables (s_w0 to s_w6) with a 20x2 chip, is there a reason i am missing to why i get an error if used with a bintoascii command.

The syntax error is, "Word Variable Required" but s_w0 to s_w6 are word variables, what am i missing here??

If the code is changed back to a General word variable all works, (example:- change "s_w0" to "w0")
 

tarzan

Senior Member
The X1 and X2 parts have 8 word variables and 1 flags byte which are reserved for
system hardware use. However if that piece of system hardware is not used within
a program the variables may be used as general purpose variables.
s_w0 - reserved for future use
s_w1 - reserved for future use
s_w2 adcsteup2 high word of adcsetup (28X2 only)
s_w3 timer3 timer3 value (X2 only)
s_w4 compvalue comparator results (X2 only)
s_w5 hserptr hardware serin pointer
s_w6 hi2clast hardware hi2c last byte written (slave mode)
s_w7 timer timer value
P.E. v5.5.0 works for me.

Code:
#picaxe 20x2
s_w0 = %11000000111001
bintoascii s_w0,b4,b3,b2,b1,b0
serout A.0, n2400,(b4,b3,b2,b1,b0)
 
Last edited:

SAborn

Senior Member
It might be a glitch in PE 5.4 then as your code example wont work for me, i still get a error.
 

tarzan

Senior Member
I just tried P.E. v5.4.2 and the code example did not work. Suggest that you upgrade to the latest version of the P.E.
 

SAborn

Senior Member
Thanks Tarzan,

I have upgraded to PE 5.50 and yes you are correct it all works as expected now.

Your assistance is much appreciated, as i thought there was something i was missing, but just could not see the trees through the forest, didnt even think of a bug in PE to be an issue.
 

inglewoodpete

Senior Member
PE Version 5.4.3

The following works but I had to add the "%".
Code:
#picaxe 20x2
s_w0 = [COLOR="#FF0000"][B]%[/B][/COLOR]000000111001

bintoascii s_w0,b4,b3,b2,b1,b0

serout A.0, n2400,(b4,b3,b2,b1,b0)
 

tarzan

Senior Member
It was meant to be a little more than that. “%11”
And this is the reason that I hardly ever post anything anymore. When I try to use this system there is always an inconsistency with what is entered and what is posted.
 
Last edited:

nick12ab

Senior Member
It was meant to be a little more than that. “%11”
And this is the reason that I hardly ever post anything anymore. When I try to use this system there is always an inconsistency with what is entered and what is posted.
I always get the correct result as long as I don't edit the post afterwards.

TEST - %11
TEST - %11
TEST - %11
Code:
let pinsb = %1101
Code:
let pinsb = [I]%[/I]1101
Code:
main:
    dirsB = 255
    low rs
    output backlightpin
    lcddata = %00000110 : pulsout enable,100
    lcddata = %00001100 : pulsout enable,100
    lcddata = %00111011 : pulsout enable,100
    lcddata = %00000001 : pulsout enable,100
    tmr3setup %00110011
    low rs
    setfreq m16
    settimer t1s_16
Strange. It seems that the problem cannot be forced to happen, it only happens when you don't want it to.
 
Last edited:

hippy

Ex-Staff (retired)
Strange. It seems that the problem cannot be forced to happen, it only happens when you don't want it to.
A %xx sequence is a standard means for URL character encoding so my guess is it's most likely the type of edit field being used, vBulletin processing or browser used invoking some translation of %xx to something else.

In my user settings I have "Basic Editor - A simple text box" and have never run into any problem with % usage.
 

SAborn

Senior Member
It was meant to be a little more than that. “%11”
And this is the reason that I hardly ever post anything anymore. When I try to use this system there is always an inconsistency with what is entered and what is posted.
Tarzan,

Dont beat yourself up too much over the missing % as i knew what you meant in the example and that is all that matters here, the example did not work with PE 5.40 but did with 5.50 and this confirmed the problem so your help was well worth the post even with a little code error (%).
 
Top