EEPROM memory
Archiver
Posts: 46,084
Using the BSII, I am recording the position of a POT into eeprom. The
rcTime variable is a word (8 bits), then write this value into eeprom
using the write command. However, EEPROM does not store values more
than 255. Do you know how I can store full words rather than only
bytes into memory?
thanks
Al Najjar
rcTime variable is a word (8 bits), then write this value into eeprom
using the write command. However, EEPROM does not store values more
than 255. Do you know how I can store full words rather than only
bytes into memory?
thanks
Al Najjar
Comments
WRITE x, aWord.highbyte
WRITE x+1,aWord.lowbyte
and then reverse for the read...
Al Williams
AWC
* 8 channels of PWM:
http://www.al-williams.com/awce/pak5.htm
>
Original Message
> From: brownstamp@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=dGU3guoC5K5nRsGDjglu4ICtz-3M8VmKsAD7pjaaR9id54OieU8yboOiL1ho0HKVGEIua_a9EEdTvQ]brownstamp@y...[/url
> Sent: Wednesday, May 23, 2001 1:57 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] EEPROM memory
>
>
> Using the BSII, I am recording the position of a POT into eeprom. The
> rcTime variable is a word (8 bits), then write this value into eeprom
> using the write command. However, EEPROM does not store values more
> than 255. Do you know how I can store full words rather than only
> bytes into memory?
>
>
> thanks
>
>
> Al Najjar
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
It works but I am not sure if I am converting things correctly.
Here is what I am trying, I use the value 1000 (decimal) stored in
a word variable (x), I write the x.highbyte into location 1, x.lowbyte
into location 2 and then try to debug x, I get 232 which is only the
low byte!
I tried this also:
x var word
x= 1000
debug dec x.lowbyte
I get 232
debug dec x.highbyte
I get 3
Could you please what is going on and do I need to do any conversions
before or after spliting/combining bytes?
Many thanks again....
--- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
> You need to store the two halves separately:
>
> WRITE x, aWord.highbyte
> WRITE x+1,aWord.lowbyte
>
> and then reverse for the read...
>
> Al Williams
> AWC
> * 8 channels of PWM:
> http://www.al-williams.com/awce/pak5.htm
>
>
> >
Original Message
> > From: brownstamp@y... [noparse][[/noparse]mailto:brownstamp@y...]
> > Sent: Wednesday, May 23, 2001 1:57 PM
> > To: basicstamps@y...
> > Subject: [noparse][[/noparse]basicstamps] EEPROM memory
> >
> >
> > Using the BSII, I am recording the position of a POT into eeprom.
The
> > rcTime variable is a word (8 bits), then write this value into
eeprom
> > using the write command. However, EEPROM does not store values
more
> > than 255. Do you know how I can store full words rather than only
> > bytes into memory?
> >
> >
> > thanks
> >
> >
> > Al Najjar
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
1000 decimal is 3E8 in hex. So that is a high value of $03 and a low value
of $E8.
3 is 3
and $E8 is 232
so that is correct!
When you reverse it:
x.highbyte=3
x.lowbyte=$E8
debug ?x
It should work fine.
Al Williams
AWC
* 8 channels of PWM:
http://www.al-williams.com/awce/pak5.htm
>
Original Message
> From: brownstamp@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=dCtSYisKyzycBVJ5QfoXcQwVNwB9LGWQxltRJGcF-gmgqWo0TfoLUoY_196scrEVdcCq3YL8yy8jBFr5jDs]brownstamp@y...[/url
> Sent: Wednesday, May 23, 2001 8:02 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: EEPROM memory
>
>
> Thanks Al W.
>
> It works but I am not sure if I am converting things correctly.
> Here is what I am trying, I use the value 1000 (decimal) stored in
> a word variable (x), I write the x.highbyte into location 1, x.lowbyte
> into location 2 and then try to debug x, I get 232 which is only the
Although I understand the concept, I cannot apply it correctly into my
code. I am sure there is a silly mistake as usual. Will keep hacking
at it until it works.
sincere thanks again
Al Najjar
--- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
> The trick is to think about the hex value.
>
> 1000 decimal is 3E8 in hex. So that is a high value of $03 and a low
value
> of $E8.
>
> 3 is 3
> and $E8 is 232
>
> so that is correct!
> When you reverse it:
>
> x.highbyte=3
> x.lowbyte=$E8
> debug ?x
>
> It should work fine.
>
> Al Williams
> AWC
> * 8 channels of PWM:
> http://www.al-williams.com/awce/pak5.htm
>
> >
Original Message
> > From: brownstamp@y... [noparse][[/noparse]mailto:brownstamp@y...]
> > Sent: Wednesday, May 23, 2001 8:02 PM
> > To: basicstamps@y...
> > Subject: [noparse][[/noparse]basicstamps] Re: EEPROM memory
> >
> >
> > Thanks Al W.
> >
> > It works but I am not sure if I am converting things correctly.
> > Here is what I am trying, I use the value 1000 (decimal) stored in
> > a word variable (x), I write the x.highbyte into location 1,
x.lowbyte
> > into location 2 and then try to debug x, I get 232 which is only
the
(Early in the AM so forgive any syntax errors)
eeaddress var word
eeword var word
main: ' your code here
eeaddress=0
loop: ' still your code here
x=*$&(&#$@ ' whatever your code is
eeword=x
gosub writeword
eeword=eeword+1
if eeword>=100 then dumpit ' whatever your code is???
goto loop
dumpit: ' still your code
for eeaddress=0 to 99
gosub readword
debug dec eeaddress,":",eeword
next
goto main ' or whatever
' *** END OF YOUR CODE
' start subroutines
' These multiply the address by 2 so you store at
' 0=0, 1=2, 2=4, 3=6, etc.
writeword:
write eeaddress*2,eeword.lowbyte
write eeaddress*2+1,eeword.highbyte
return
readword:
read eeaddress*2,eeword.lowbyte
read eeaddress*2+1,eeword.highbyte
return
Does that help?
Al Williams
AWC
* Control 8 servos at once:
http://www.al-williams.com/awce/pak8.htm
>
Original Message
> From: brownstamp@y... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=J9vb9xJdCS6zE5P5_QH26y6-9RgTWAC9kxCgCwzIF68gu6tXUnRlGd1Z_TvFmguzhjLGCdJT8n3yWt23aaM]brownstamp@y...[/url
> Sent: Wednesday, May 23, 2001 11:28 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] Re: EEPROM memory
>
>
> Thanks again!
>
> Although I understand the concept, I cannot apply it correctly into my
> code. I am sure there is a silly mistake as usual. Will keep hacking
> at it until it works.
>
> sincere thanks again
>
> Al Najjar
>
> --- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
> > The trick is to think about the hex value.
> >
> > 1000 decimal is 3E8 in hex. So that is a high value of $03 and a low
> value
> > of $E8.
> >
> > 3 is 3
> > and $E8 is 232
> >
> > so that is correct!
> > When you reverse it:
> >
> > x.highbyte=3
> > x.lowbyte=$E8
> > debug ?x
> >
> > It should work fine.
> >
> > Al Williams
> > AWC
> > * 8 channels of PWM:
> > http://www.al-williams.com/awce/pak5.htm
> >
> > >
Original Message
> > > From: brownstamp@y... [noparse][[/noparse]mailto:brownstamp@y...]
> > > Sent: Wednesday, May 23, 2001 8:02 PM
> > > To: basicstamps@y...
> > > Subject: [noparse][[/noparse]basicstamps] Re: EEPROM memory
> > >
> > >
> > > Thanks Al W.
> > >
> > > It works but I am not sure if I am converting things correctly.
> > > Here is what I am trying, I use the value 1000 (decimal) stored in
> > > a word variable (x), I write the x.highbyte into location 1,
> x.lowbyte
> > > into location 2 and then try to debug x, I get 232 which is only
> the
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
Should be:
debug dec eeaddress,":",dec eeword
Sorry!
Al Williams
AWC
* Control 8 servos at once:
http://www.al-williams.com/awce/pak8.htm