Increasing Word Variables

ZeroScope

New Member
I am using an 18X chip to be used with a thermistor as a temperatuer sensor.

I am using the peek/poke commands in order to be able to retrieve a value dependant on a word variable (w0). Before i tried this i used an 8-bit set up and it worked fine.
I have a button that i used to increase the 8 bit variable so that it would increase the ADC value and therefore take the next value from the peek/poke setup. I am now using a 10 bit setup to read the ADC and so have to use word variable.
When i set the button up to increase the word variable nothing happens it seems that using the command,

if pin1 = 1 then inctargettemp

inctargettemp:
w0 = w0 + 1
goto peeknpoke

does nothing to increase the w0 variable.

The w0 variable is using the b0 and b1 bytes, so i tried increasing the b0 value. This works but (using a similar setup to above) will only increase the first bit b0 and so only has 256 values as apposed to being able to change b1 aswell and use 10 bit.

Any ideas on how i can increase the value of the word variable using a button?
thanks in advance :)
 

hippy

Ex-Staff (retired)
"w0=w0+1" does work -- people would have noticed by now if it didn't -- which means it's something else in your program which is causing a problem, altering w0. Perhaps your 'peeknpoke' routine or somewhere else where you are using b0, b1 or bit0 through bit15 ?
 
Top