Remote-processing RPC-2350 Uživatelský manuál Strana 19

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 83
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 18
SAVING AND LINKING PROGRAMS CHAPTER 3
3-4
.
.
7000 IF A = 0 THEN 7100
.
.
7100 EXIT CLEAR
7110 LOAD 1 RUN
The above example shows how to link to another
program within a subroutine. If you do not use EXIT
CLEAR, you will eventually end up with an <Out of
memory> error.
Declare variables
All variables, dimensioned arrays, and string variables
should be declared in the first program. These variables
are accessible to both programs.
Program Re-entry
There is a good chance you will have declared a
dimensioned array or made room for strings in the
autorun progr am. If you do a C LEA R again, all
variables will be cleared.
What you must do when you enter a program is to test
for a re-entry flag at the start. If it is 0, then the
program know s to go and do va riable initialization. If it
is not 0, then it skips around it. For example:
10 IF FLAG <> 0 THEN 100
20 CLEAR 500 :’Clear space
30 DIM WEIGHT(100)
40 DIM B$(20)
.
. More initialization code
.
100 FLAG = 1:’Signal initialized
110 ON ERR GOTO 10000
120 CONFIG COM$ 2,0,8,0,1
130 ON COM$ 2 GOSUB 2000
The code will not skip around the multitasking
statements when it is first Autorun. This is because, by
default, all Basic variables are reset to 0. When you link
programs, variables remain intact.
SAVING PROGRAMS VS SAVING DATA
A program number and F lash segment are related by the
following formula:
Flash segment = program number + 8
If you intend to save data to Flash, m ake sure you do not
write to a program area. Programs are always saved
starting at address 0 and continue until end of program.
You can save data above a program.
The important thing here is to remember that saving
programs to Flash and saving data to Flash are related.
COMMANDS
The following is a list of CAMBASIC commands used
for saving and loading programs.
Command Function
LOAD Transfers program from U3 to RAM
for editing or running.
LOAD n Transfers program of specified area of
U3 to RAM.
LOAD data Multi-part syntax command that
moves data from Flash to RAM or
RAM to RAM. Refer to Chapter 5 or
the CAMBASIC manual for more
information.
SAVE Saves a program from RAM to U3 for
Autorun
SAVE n Save a program from RAM to a
program area of Flash.
SAVE data Multi-part syntax command that saves
data from RAM to Flash. Refer to
Chapter 5 or the CAMBASIC manual
for more inform ation
Zobrazit stránku 18
1 2 ... 14 15 16 17 18 19 20 21 22 23 24 ... 82 83

Komentáře k této Příručce

Žádné komentáře