read/write
Archiver
Posts: 46,084
I have a program on the BS2SX that uses two "pages". It frequently
jumps, or runs, to another page. I have some variables on the first
page, and I don't want to have to copy them to both pages. I also
use a variable to tell the program where to jump to. for example:
'First page
RunVar var nib
if RunVar = 1 then one
if RunVar = 2 then two
Main: 'it must go to the second page to execute code
RunVar=3
run 1
one:
debug "done"
stop
'
'Second Page
RunVar var nib '<--- I don't want to put this on the 2nd page
if RunVar=3 then one
if RunVar=4 then two
one:
debug "second page"
RunVar=1
run 0
==============================================
The variables won't carry over to the other page, so I've been
trying to use the write/read commands to write the variables to
EEPROM. I have data being stored in the EEPROM, but I have used @9
before the first data entry to clear space for it to write/read. I
have been looking at the EEPROM map after I run the program, and
nothing is being stored in the space that I have cleared for it.
What am I doing wrong and is there a better way to tell the program
where to jump to after the "run" command? Thanks.
jumps, or runs, to another page. I have some variables on the first
page, and I don't want to have to copy them to both pages. I also
use a variable to tell the program where to jump to. for example:
'First page
RunVar var nib
if RunVar = 1 then one
if RunVar = 2 then two
Main: 'it must go to the second page to execute code
RunVar=3
run 1
one:
debug "done"
stop
'
'Second Page
RunVar var nib '<--- I don't want to put this on the 2nd page
if RunVar=3 then one
if RunVar=4 then two
one:
debug "second page"
RunVar=1
run 0
==============================================
The variables won't carry over to the other page, so I've been
trying to use the write/read commands to write the variables to
EEPROM. I have data being stored in the EEPROM, but I have used @9
before the first data entry to clear space for it to write/read. I
have been looking at the EEPROM map after I run the program, and
nothing is being stored in the space that I have cleared for it.
What am I doing wrong and is there a better way to tell the program
where to jump to after the "run" command? Thanks.
Comments
jumps, or runs, to another page. I have some variables on the first
page, and I don't want to have to copy them to both pages. I also
use a variable to tell the program where to jump to. for example:
'First page
RunVar var nib
if RunVar = 1 then one
if RunVar = 2 then two
Main: 'it must go to the second page to execute code
RunVar=3
run 1
one:
debug "done"
stop
'
'Second Page
RunVar var nib '<--- I don't want to put this on the 2nd page
if RunVar=3 then one
if RunVar=4 then two
one:
debug "second page"
RunVar=1
run 0
==============================================
The variables won't carry over to the other page, so I've been
trying to use the write/read commands to write the variables to
EEPROM. I have data being stored in the EEPROM, but I have used @9
before the first data entry to clear space for it to write/read. I
have been looking at the EEPROM map after I run the program, and
nothing is being stored in the space that I have cleared for it.
What am I doing wrong and is there a better way to tell the program
where to jump to after the "run" command? Thanks.
>have been looking at the EEPROM map after I run the program, and
>nothing is being stored in the space that I have cleared
The eeprom map (that shows up when you press CTRL-M) only shows the
map as it exists at compile time, and not any changes that occur at
run time. I think that is what you mean? If you want to see the
contents at run time, you will have to write a little routine in your
program to READ the data and send it to debug.
>I have some variables on the first page, and I don't want to have to
>copy them to both pages. I also use a variable to tell the program
>where to jump to. for example:
>'First page
>RunVar var nib
>'
>'Second Page
>RunVar var nib '<--- I don't want to put this on the 2nd page
>
>The variables won't carry over to the other page, so I've been
>trying to use the write/read commands to write the variables to
>EEPROM.
I don't understand why you want to use the EEPROM for this? How
about using the scratchpad RAM?
I do like to use a RAM variable for this purpose. However, it is not
a good idea to define it as a VAR nib. There are several ways to.
Here is a link to a recent thread on the subject
http://groups.yahoo.com/group/basicstamps/message/19311
I also have some information on my web site at
http://www.owlogic.com/BS2SX.htm
-- regards,
Tracy Allen
electronically monitored ecosystems
mailto:tracy@e...
http://www.emesystems.com