![Rabbit 3000 Скачать руководство пользователя страница 234](http://html2.mh-extra.com/html/rabbit/3000/3000_user-manual_3114034234.webp)
226
Rabbit 3000 Microprocessor
18.2 Reading and Writing I/O Registers
The Rabbit has two I/O spaces: internal I/O registers and external I/O registers.
18.2.1 Using Assembly Language
The fastest way to read and write I/O registers in Dynamic C is to use a short segment of
assembly language inserted in the C program. Access is the same as for accessing data
memory except that the instruction is preceded by a prefix (
IOI
or
IOE
) to indicate the
internal or external I/O space. For example:
// compute value and write to Port A Data Register
value=x+y
#asm
ld a,(value) ; value to write
ioi ld (PADR),a ; write value to PADR
#endasm
In the example above the
IOI
prefix changes a store to memory to a store to an internal
I/O port. The prefix
ioe
is used for writes to external I/O ports.
18.2.2 Using Library Functions
Dynamic C functions are available to read and write I/O registers. These functions are pro-
vided for convenience. For speed, assembly code is recommended. For a complete
description of the functions noted in this section, refer to the Dynamic C Premier User’s
Manual or from the
Help
menu in Dynamic C, access the
HTML Function Reference
or
Function Lookup
options.
To read internal I/O registers, there are two functions.
int RdPortI(int PORT) ; // returns PORT, high byte zero
int BitRdPortI(int PORT, int bitcode); // bit code 0-7
To write internal I/O registers, there are two functions.
void WrPortI(int PORT, char *PORTShadow, int value);
void BitWrPortI(int PORT, char *PORTShadow, int value, int bitcode);
The external registers are also accessible with Dynamic C functions.
int RdPortE(int PORT) ; // returns PORT, high byte zero
int BitRdPortE(int PORT, int bitcode); // bit code 0-7
int WrPortE(int PORT, char *PORTShadow, int value);
int BitWrPortE(int PORT, char *PORTShadow, int value, int bitcode);
In order to read a port the following code could be used:
k=RdPortI(PADR); // returns Port A Data Register
Содержание 3000
Страница 1: ...Rabbit 3000 Microprocessor User s Manual 019 0108 020426 A...
Страница 8: ...Rabbit 3000 Microprocessor...
Страница 28: ...20 Rabbit 3000 Microprocessor...
Страница 73: ...User s Manual 65 6 RABBIT INTERNAL I O REGISTERS...
Страница 122: ...114 Rabbit 3000 Microprocessor...
Страница 138: ...130 Rabbit 3000 Microprocessor...
Страница 150: ...142 Rabbit 3000 Microprocessor...
Страница 188: ...180 Rabbit 3000 Microprocessor...
Страница 208: ...200 Rabbit 3000 Microprocessor...
Страница 228: ...220 Rabbit 3000 Microprocessor...
Страница 232: ...224 Rabbit 3000 Microprocessor...
Страница 238: ...230 Rabbit 3000 Microprocessor...
Страница 260: ...252 Rabbit 3000 Microprocessor...
Страница 266: ......