23
3.3 Example of Creating a Standard I/O Driver
3.3
Example of Creating a Standard I/O Driver
Figure 3.3 shows an example of how to incorporate a standard I/O driver.
■
Example of creating a standard I/O driver
.program
mb89371
.title
mb89371
#include scdef_s.inc
IO
.section
IO_mb89371, IO, LOCATE=H’C0
;MB89371
RS_DATA
.res.b
1
;h'C0 data register
.res.b
1
RS_CTRL
.res.b
1
;h'C2 control register
.res.b
1
RS_BOUD
.res.b
1
;h'C4 371 baud rate register
.res.b
1
RS_CTRL1
.res.b
;h'C6 371 mode register
CSEG
.section
CODE_mb89371, CODE, ALIGN=2
;----------------------------------------
; Define entry
;----------------------------------------
.export
_stdout, _stdin
_stdout
.data.l
chrout
_stdin
.data.l
chrinp
;---------------------------------------------------
; Serial data transmitter/receiver_iSDTR_FMB89371)
RCLR
.equ
H'40
; error reset
RMODE
.equ
B'01001111
; mode (8251 compatible)
RMODE1
.equ
B'01000010
; mode (8251 compatible)
RBOUD
.equ
B'00000010
; 9600bps
RCOMM
.equ
B'00010101
; receive&transmit
RSERR
.equ
B'00111000
; pattern of error
RXRDY
.equ
1
; status bit of receiver
TXRDY
.equ
0
; status bit of transmission
UsartAccessDelayTime .equ10
; wait time
;---------------------------------------------------
; _uart_init (MB89371 initialize)
;
;
*PARAMETER*
;
None
;
*RETURN*
;
None
;
*ERROR CODE*
;
None
;---------------------------------------------------
.export
_uart_init
_uart_init:
mov
i:RS_CTRL, #0
; MB89371 reset
call
delay
mov
i:RS_CTRL, #0
call
delay
mov
i:RS_CTRL, #0
call
delay
Figure 3.3 Example of Creating a Standard I/O Driver (Continued...)
*
Содержание F2MC-16L Series
Страница 2: ... ...
Страница 4: ... ...
Страница 10: ...vi ...
Страница 12: ...viii ...
Страница 44: ...32 CHAPTER 4 Program Reference for the Standard I O Library ...
Страница 53: ...41 APPENDIX B Running the Sample System Figure Be Project Member List ...
Страница 54: ...42 APPENDIX Figure Bf Set Configuration File Dialog Box ...
Страница 64: ...52 APPENDIX Figure Cb Sample System Memory Map Continued ...
Страница 65: ...53 INDEX INDEX The index follows on the next page This is listed in alphabetic order ...
Страница 68: ... ...