![Intel 8XC196NT Скачать руководство пользователя страница 222](http://html1.mh-extra.com/html/intel/8xc196nt/8xc196nt_user-manual_2072210222.webp)
9-9
SLAVE PORT
The master first reads the P3_REG register. This ensures that the slave’s P3_REG is indeed emp-
ty, clears the OBF flag, and pulls SLPINT low. Next, it loads the address it wants to read into the
SLP_CMD register. This causes a CBF interrupt in the slave processor. The slave reads that lo-
cation and stores the data in P3_REG, which sets the OBF flag and forces SLPINT high. This
notifies the master to read the P3_REG register.
9.4.1.2
Slave Device Program
Once the slave port and ports 3 and 5 are initialized, the slave device program is strictly interrupt
driven. When the slave device receives a byte in the SLP_CMD register, the command buffer full
(CBF) interrupt is generated. The CBF interrupt service routine reads the OBF and IBE flags in
the SLP_STAT register to determine whether the master device is sending data or requesting a
data read. For a data-read request, the master device clears P3_REG, which clears the OBF flag,
before it loads SLP_CMD. For a data write, the master writes P3_PIN, which clears the IBE flag,
before it loads SLP_CMD. Therefore, only one of the two flags is clear when the CBF interrupt
service routine is entered.
If the IBE flag is clear (the input buffer, P3_PIN, is full), the slave moves the data from the
P3_PIN register to the specified address. If the OBF flag is clear (the output buffer, P3_REG, is
empty), the slave moves the data from the specified address to the P3_REG register so that the
master can read it.
The following code segment shows the CBF interrupt service routine. The CBF interrupt must be
enabled and interrupts must be globally enabled for this routine to function.
CBF_ISR:
PUSHA
LDBZE MAILBOX, SLP_CMD[0]
; read SLP_CMD value (mailbox=address)
ADDB 1, BASE
; window address is 400-4FFH
LDB
TEMPW, SLP_STAT[0]
; get SLP_STAT register
BBC
TEMPW, 1, WRITE_DATA
; if IBE=0, master wants to write
BBC
TEMPW, 0, READ_DATA
; if OBF=0, master wants to read
; if neither IBE=0 nor OBF=0, RETURN
; if both are set, an error has occurred
; no read or write can be performed
; (BBC is an assembler command that is
; translated to either a JBC, SJMP, or LJMP,
; depending upon the distance to the
; referenced address.)
DONE_ISR:
POPA
RET
WRITE_DATA:
LDB
TEMPW, P3_PIN[0]
; get data to write
STB
TEMPW, [MAILBOX]
; write P3_PIN at 400H
POPA
RET
Содержание 8XC196NT
Страница 1: ...8XC196NT Microcontroller User s Manual...
Страница 2: ...8XC196NT Microcontroller User s Manual June 1995 Order Number 272317 003...
Страница 22: ...1 Guide to This Manual...
Страница 23: ......
Страница 35: ......
Страница 36: ...2 Architectural Overview...
Страница 37: ......
Страница 49: ......
Страница 50: ...3 Programming Considerations...
Страница 51: ......
Страница 66: ...4 Memory Partitions...
Страница 67: ......
Страница 104: ...5 Standard and PTS Interrupts...
Страница 105: ......
Страница 147: ......
Страница 148: ...6 I O Ports...
Страница 149: ......
Страница 176: ...7 Serial I O SIO Port...
Страница 177: ......
Страница 194: ...8 Synchronous Serial I O SSIO Port...
Страница 195: ......
Страница 211: ......
Страница 212: ...9 Slave Port...
Страница 213: ......
Страница 231: ......
Страница 232: ...10 Event Processor Array EPA...
Страница 233: ......
Страница 270: ...11 Analog to digital Converter...
Страница 271: ......
Страница 291: ......
Страница 292: ...12 Minimum Hardware Considerations...
Страница 293: ......
Страница 306: ...13 Special Operating Modes...
Страница 307: ......
Страница 317: ......
Страница 318: ...14 Interfacing with External Memory...
Страница 319: ......
Страница 362: ...15 Programming the Nonvolatile Memory...
Страница 363: ......
Страница 408: ...A Instruction Set Reference...
Страница 409: ......
Страница 476: ...B Signal Descriptions...
Страница 477: ......
Страница 493: ......
Страница 494: ...C Registers...
Страница 495: ......
Страница 565: ......
Страница 566: ...Glossary...
Страница 567: ......
Страница 580: ...Index...
Страница 581: ......
Страница 597: ......