Hi
I am trying to store a binary value o or 1 into a permanent location which remains when the chip is switched off. However no matter what I do the code always defaults to displaying a value which represents a zero value being read from the eprom. So if I try to write 1 to location 1 eg write 1,1 and then i read the value read 1,b1 b1 is always returned as 0
I know its something simple that I am missing and I am probably over looking but I am totally stuck!
Can someone please look at this example code and tell me why no matter what selection is made (pin1 or pin2 made high) the words "stored value is 0" are always displayed. (I know the code doesn't allow for switch bounce etc, its only to demonstrate my problem)
Thanks for your help.
I am trying to store a binary value o or 1 into a permanent location which remains when the chip is switched off. However no matter what I do the code always defaults to displaying a value which represents a zero value being read from the eprom. So if I try to write 1 to location 1 eg write 1,1 and then i read the value read 1,b1 b1 is always returned as 0
I know its something simple that I am missing and I am probably over looking but I am totally stuck!
Can someone please look at this example code and tell me why no matter what selection is made (pin1 or pin2 made high) the words "stored value is 0" are always displayed. (I know the code doesn't allow for switch bounce etc, its only to demonstrate my problem)
Thanks for your help.
Code:
symbol swtch=b1
main:
read 1,b1
if swtch=1 then
serout B.1,N2400,(254,72) ; move to start of first line
serout B.1,N2400,("stored value is 1")
end if
if swtch=0 then
serout B.1,N2400,(254,72) ; move to start of first line
serout B.1,N2400,("stored value is 0")
end if
do while pin3<>1
if pin1=1 then
write 1,1
end if
if pin2=1 then
write 1,0
endif
loop
goto main