8.11 Program Examples for 8-bit Serial I/O
This section gives program examples for 8-bit serial I/O.
Program Example for Serial Output
Processing description
•
Outputs 8 bits of serial data (55H) from the SO pin of serial I/O, then generates an interrupt
when transfer is completed.
•
The interrupt processing routine resets the transfer data and continues output.
•
Operates using an internal shift clock and outputs the shift clock from the SCK pin.
•
If the shift clock is set to 32 tinst,with the main clock at 4.2MHz source oscillation (F
at the maximum (gear) speed (1 insutruction cycle=4/F
the transfer speed and interrupt generation cycle are as follows:
Transfer speed = 4.2 MHz/4/32 = 32.8 kbps
Interrupt cycle = 4 × 32 × 8/4.2 MHz = 243.8 µs
Coding example
SMR
EQU
SDR
EQU
SIOF
EQU
SST
EQU
ILR2
EQU
INT_V
DSEG
ORG
IRQ4
DW
INT_V
ENDS
:-----Main program----------------------------------------------------------------------------------------------------------------------------------------
CSEG
:
CLRI
001CH
001DH
SMR:7
SMR:0
007DH
ABS
0FFF2H
WARI
8.11 Program Examples for 8-bit Serial I/O
; Address of serial mode register
; Address of serial data register
; Define the interrupt request flag bit.
; Define the serial I/O transfer start bit.
; Address of the interrupt level setting register
; [DATA SEGMENT]
; Set interrupt vector.
; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
; Disable interrupts.
) as well,the transfer speed and
CH
) and
CH
215