Remote-processing RPC-30 Manual do Utilizador Página 20

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 38
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 19
RAM MEMORY CHAPTER 5
Page 18 RPC-30
Upon reset, the calibration value is checked. If the value
at address 0 agrees with address 100 and 200, then no
corruption occurred. When address 0 and 100 agree but
not 200, then this indicates that a reset occurre d while
updating the third set. The first data set can be trusted.
The third data set simply needs to be updated.
When the first two sets do not agree, then you know that
the first data is corrupted. If the second and third set
agree, then, depending upon the system r equireme nts,
the first set could be "corrected" using the old data. The
user or other device could be alerted that a calibration
(or other ) must be performed again. W hen all thre e sets
disagree, then you must take action appropriate to the
situation.
Another technique to ch eck for valid mem ory is
checksums. Simply writing a program to add the values
in RAM and compare it against a number is a good
check. However, you cannot tell which data element
was corrupted.
Instances of data corruption are rar e. T hey do increase
as the board power is cycled or reset. You should be
aware that data corruption is not impossible and there are
methods to detect and correct it.
ASSEMBLY LANGUAGE INTERFACE
Assembly language programs (including compiled C)
must start from segment 0. Use the CAMBASIC CALL
statement to execute an assembly language program.
A specific area of RAM should be reserved for the
program. This is to prevent strings and variables from
corrupting that area of RAM . Use the SYS(1) and
SYS(2) statements to do this. SYS(1) retur ns the lowest
memory location while SYS(2) returns the upper
location. Run the program first to make sure variable
memory has been allocated before running these SYS
commands. F ailure to do so may r esult in an address
that is not really free for assembly language pr ogram s.
There are sever al ways to put a program in mem ory,
depending upon your application.
1. Use DATA statements and POKE the code
2. Write a program to download code. Some
applications are connected to a larger system which
"initializes" its systems. Using INKEY $ or COM $,
code is received and then poked into memory using
POKE$.
3. Read the code from the EEPROM (U8) (using INP)
and transfer it to RA M (using POKE ). Y ou would
have to use an external programmer to place the
code above CAMBASIC code.
In all cases, it is best to load code into RAM from a
"secure" source. E ven though RAM is battery backed,
over time there is the possibility it could be corrupted.
Below is an example of loading and running an asse mbly
language program.
100 FOR N = &FB00 TO &FB0C
110 READ A
120 POKE N,A
130 NEXT
900 DATA &DB, 2, &47, &E6, &FE, &D3
910 DATA 2, &78, &F6, 1, &D3, 2, &C9
2000 CALL &FB00
Lines 100 to 130 load the program into RAM. DATA
statements may be entered manually or made by the
MAKED B program included with PC SmartLINK.
Line 2000 calls the program listed below. It toggles J3
line 13.
IN A,(2)
LD B,A
AND 0FEH
OUT (2),A
LD A,B
OR 1
OUT (2),A
RET
COMMANDS
The following is a list of CAMBASIC commands used
with RAM.
Command Function
CALL Calls an assembly language routine
CLEAR Clears strings and allocates string space
PEEK Returns a byte
DPEEK Returns a 16 bit value
PEEK$ Returns a string
FPEEK Returns a floating point number
POKE Stores a by te
DPOKE Stores a 16 bit value
POKE$ Stores a string
FPOKE Stores a floating point number
Vista de página 19
1 2 ... 15 16 17 18 19 20 21 22 23 24 25 ... 37 38

Comentários a estes Manuais

Sem comentários