Saving and linking programs chapter 3 – Remote Processing RPC-2350 User Manual

Page 17

Advertising
background image

SAVING AND LINKING PROGRAMS

CHAPTER 3

3-2

Where ‘ program’ is 0 or 1 for 128K Flash or 0 to 7 for
512K Flash installed.

“SA VE” and “ SAVE 0" ar e the same . Both sa ve to
program location 0.

Type in the following command for this example:

SAVE

CAM BASIC will compile the program , progr am the
EPR OM, and verify its contents.

Compile...Write...Verify

The time it takes to do all of this depends upon the
length and co mplexity of the progr am. Gener ally, it w ill
be from 1 to 20 second s. T he read y prom pt (> ) will
appear when the p rogr am has b een succes sfully saved to
the EPROM . If the program does not write to the
EPROM, an error message will appear:

Fail @ xxxx

Saving a pr ogram overw rites the pr evious one. Ther e is
no way to recover it since both occupy the same space.

AUTORUNNING

The pr ogram stored using SAVE or SAV E 0 will
a u to r u n. T o a ut or u n a p r o gr a m :

1.

Make sure there is a program in EP ROM (from
above) stored by using SAVE or SA VE 0.

2.

Make sure the autorun jumpe r W11 is installed.

If you push the reset button, the program should run. If
there are any err ors, the pr ogram will stop (assuming
you have not trapped them with ON E RROR) and
display the error message.

PREVENTING AUTORUN

When troubleshooting or maintaining a program , it' s not
always co nvenient for an autoexec ute file to run. This is
especially tr ue if the pro gram has been co nfigured to
ignore the < ESC> key. To pr event autorun, re move
jumper W11.

L a te r , i f y o u w i sh to S AV E o r L OA D a pr o g ra m ,
reinstall this jumper. You may do so even if the power
is on and a program is running. Remember to discharge

any static electricity before installing or removing the
jumper.

Another way to prevent autorun is to rem ove the
signature bytes from Flash. This is done by writing
&FF ’s into Flash address 0 and 1, segment 8. Use the
following steps to do this.

dpoke &8000,&ffff
save 8,0,0,0,&8000,2

This will overwrite the first 128 to 256 bytes of code and
prevent autorun.

LOADING PROGRAMS

Ther e are tim es when y ou may w ish to tempor arily
m o d if y or o th e r wi se te s t o u t a c ha n ge to a pr o g ra m .
Since the program is loaded into RAM, modifications
can be made without affecting the program in EPROM.
If you find out tha t modification s are not de sirable or did
not work, you can restore the original program to RAM
using the LOAD com mand.

This version of CAM BASIC can link and run 2
program s with a 128K or 8 with 512K flash. Because of
this linking ability, you should do some things during
development to limit problems. Before loading a new
progr am, enter the fo llowing com mand fir st:

new

If you are loading one pr ogram through F lash, saving it,
stopping, then loading an other pr ogram and runn ing it,
you may notice som e oddities, like incorr ect varia ble
values or syntax er rors to lines not in your code. This
oddity is probably due to the program size difference. If
you do not type in NEW to start with, LOA Ding w ill
clobber what is in m emor y and nothing w ill be right.

If you are using multitasking routines, such as ON BIT
or ON TIC K, then it is best to reset the board and then
load the pr ogram during de velopme nt.

The othe r (and be st) way to take care of th is problem is
t o r e se t t he b oa r d , th e n l oa d th e pr o g ra m .

Use LOAD 0 to retrieve programs saved using SAVE 0
or SAVE and use LOAD n to retrieve programs saved
using SAVE n. ‘n’ is 0 or 1 for 128K Flash and 0 to 7
for 512K.

Advertising