Fujitsu F2MC-8L MB89620 Series Hardware Manual page 244

8-bit microcontroller
Table of Contents

Advertisement

n Program Example for Serial Input
l
Processing description
Inputs 8 bits of serial data from the SI1 pin of serial I/O-1, then generates an interrupt when
transfer is completed.
The interrupt processing routine reads the transferred data and continues input.
Serial I/O uses the external shift clock. The shift clock is input from the SCK1 pin.
Coding example
l
DDR3
SMR1
SDR1
SIOF
SST
ILR2
INT_V
IRQ7
INT_V
;-----Main program----------------------------------------------------------------------------------------------------------------------------------------
;-----Interrupt processing routine----------------------------------------------------------------------------------------------------------------------
WARI
;---------------------------------------------------------------------------------------------------------------------------------------------------------------
MB89620 series
EQU
000DH
EQU
001CH
EQU
001DH
EQU
SMR1:7
EQU
SMR1:0
EQU
007DH
DSEG
ABS
ORG
0FFECH
DW
WARI
ENDS
CSEG
:
MOV
DDR3,#00000000B
CLRI
CLRB
SST
MOV
ILR2,#01111111B
MOV
SMR1,#01001100B
SETB
SST
SETI
:
CLRB
SIOF
PUSHW
A
XCHW
A,T
PUSHW
A
MOV
A,SDR1
SETB
SST
:
User processing
:
POPW
A
XCHW
A,T
POPW
A
RETI
ENDS
END
CHAPTER 10 8-BIT SERIAL I/O (SERIAL I/O-1 AND SERIAL I/O-2)
; Serial 1 mode register
; Serial 1 data register
; Define the interrupt request flag bit.
; Define the serial I/O transfer start bit.
; Address of the interrupt level setting register 2
; [DATA SEGMENT]
; Set interrupt vector.
; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
; Set P31/SCK1 and P33/SI1 pin as an input.
; Disable interrupts.
; Stop serial I/O transfer.
; Set interrupt level (level 1).
; Clear interrupt request flag, enable interrupt request output,
set shift clock input (SCK1), disable serial data output (SO1),
select the external shift clock, LSB first.
; Enable serial I/O transfer.
; Enable interrupts.
; Clear interrupt request flag.
; Read transfer data.
; Enable serial I/O transfer.
10
223

Advertisement

Table of Contents
loading

Table of Contents