Fujitsu F2MC-8L Series Hardware Manual page 244

8-bit microcontroller
Hide thumbs Also See for F2MC-8L Series:
Table of Contents

Advertisement

Program Example for Serial Input
Processing description
Inputs 8 bits of serial data from the SI pin of serial I/O, 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 SCK pin.
Coding example
DDR3
EQU
SMR
EQU
SDR
EQU
SIOF
EQU
SST
EQU
ILR2
EQU
INT_V
DSEG
ORG
IRQ4
DW
INT_V
ENDS
;-----Main program-----------------------------------------------------------------------------------------------------------------------------------------
CSEG
:
MOV
CLRI
CLRB
MOV
MOV
SETB
SETI
:
000DH
001CH
; Address of serial mode register
001DH
; Address of serial data register
SMR:7
; Define the interrupt request flag bit.
SMR:0
; Define the serial I/O transfer start bit.
007DH
; Address of the interrupt level setting register
ABS
; [DATA SEGMENT]
0FFF2H
WARI
; Set interrupt vector.
; [CODE SEGMENT]
; Stack pointer (SP) etc. are already initialized.
DDR3,#00000000B
; Set P30/SCK and P32/SI pin as an input.
; Disable interrupts.
SST
; Stop serial I/O transfer.
ILR2,#11111101B
; Set interrupt level (level 1).
SMR1,#01001100B
; Clear interrupt request flag, enable interrupt request output,
set shift clock input (SCK), disable serial data output (SO),
select the external shift clock, LSB first.
SST
; Enable serial I/O transfer.
; Enable interrupts.
8.11 Program Examples for 8-bit Serial I/O
217

Advertisement

Table of Contents
loading

Table of Contents