Remote-processing RPC-220 Instrukcja Użytkownika Strona 13

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 47
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 12
WRITING, DEBUGGING, AND SAVING PROGRAMS SECTION 3
Page 3-2
Figure 3-2 I/O and RAM Map
Code starting at 0x8000 should be exactly what you
would have if you were starting in EPROM at address 0,
except there is an 0x8000 offset. Interrupts are handled
by the monitor by jumping to 0x8000 + interrupt base.
Change your C compiler start up code so it starts at
0x8000. If you ordered the development system, then
the code needed to use the Dunfield compiler has been
included. Simply install the Dunfield compiler first, then
replace the files with those on the supplemental disk.
These files are 8051RLPT .ASM , 8051RL PM. ASM, and
8051RLPL.ASM.
The I/O map is more complicated because there are
more devices to select. All I/O is accessible regardless
of the setting of the development/normal mode bit.
Figure 3-2 is the external map.
Each area is selected by the following table:
Device/area Address
Flash EPROM 0x0000 - 0x7fff
Expansion port 0x8000 - 0x9fff
Real time clock (RTC) 0xa000 - 0xbfff
RAM segment 0xc000 - 0xffff
Several demonstration programs access I/O. Directories
where programs are located:
MEM 220
RTC
FLASH
ACCESSING I/O AND RAM
I/O devices and RAM share the same addresses. Access
to them is controlled by CPU port P4.0. When this line
is high, RAM is accessed using M OVX type commands.
When this line is low, the expansion port and real time
clock are accessed.
NOTE: The I/O contr ol line, CPU port P. 0, should be
low for as short a period of time as possible.
Additionally, interrupts should be turned off
while the line is low especially if the routine
accesses external memory. The following are
suggested steps to using the I/O port.
1 Set up pointers and registers as necessary to perform
the I/O operation.
2 Turn off interrupts (if used)
3 Set CPU port P4.0 low
4 Perform the read o r wr ite
5 Set CPU port 4.0 back high
6 Enable interrupts.
Step 4 above may consist of several reads and/or writes.
The idea is to keep this time short.
Alternately, you could write interrupt ser vice routines to
check the I/O line before accessing RAM. The line
would be r estored after servicing. The reason this
method is not recommended is the amount of time
needed to read, store, and restore the status is longer
than the time it takes to code straight through. If step is
4 long (say monitoring a clock status bit), perhaps the
extra overhead m ight be wor th it.
See the MEM220.C program to see how RAM and I/O
are accessed. Specialized speek and spoke functions are
written in assembly language. This wa s done not only to
speed up memory access and reduce interrupt off time
but to ensure correct access. N ote that parameters to the
function are passed in the stack and returned in registers
A and B. Make sure your compiler passes parameters
through the stack in the memory model you are using.
You may have to adjust parameter passing for your
compiler.
MONITOR ROM
The monitor ROM allows you to download code, set
breakpoints, examine and modify RAM and I/ O. T he
monitor occupies the same space as the final program
will. Generally, the final code replaces the
monitor when the project is done. The monitor can be
re-installed under two conditions:
1 Your code allows the flash to be written to. This is a
routine that must be included in your program. See
"SAVING YOUR PROGRAM TO FLASH".
2 The flash is removed from the socket and
programmed using an external programmer.
Przeglądanie stron 12
1 2 ... 8 9 10 11 12 13 14 15 16 17 18 ... 46 47

Komentarze do niniejszej Instrukcji

Brak uwag