Ttl I/O(Gpio) Programming - FabiaTech FX5653 User Manual

Fanless series small cube system
Table of Contents

Advertisement

FabiaTech Corporation

TTL I/O(GPIO) programming

The following is an Assembly program, which demonstrates how to set the GPIO
type and how to read and write values.
;------------------------------------------------------------------------------------------
; Enter the extended function mode, interruptible double-write
;------------------------------------------------------------------------------------------
Mov
dx, 2eh
Mov
al, 87h
Out
dx,al
Out
dx,al
;------------------------------------------------------------------------------------------------------
; Configurate logical device7 , configuration register CRF0,CRF1,CRF2
; CRF0 (GP0-GP7 I/O selection register.)
;
When set to a "1", respective GPIO port is programmed as input port.
;
When set to a "0", respective GPIO port is programmed as an output port.
; CRF1 (GP0-GP7 data register.)
;
if a port is programmed to be an output port, then its respective bit can be
read/written.
;
If a port is programmed to be an input port, then its respective bit can only
be read.
; CRF2 (GP0-7 inversion register.)
;
When set to a "1", the incoming/outgoing port value is inverted.
;
When set to a "0", the incoming/outgoing port value is same as in data
register.
;------------------------------------------------------------------------------------------------------
Mov
dx,2eh
Mov
al,07h
Out
dx,al
Mov
dx,2fh
Mov
al,07h
Mov
dx,al
Mov
dx,2eh
Mov
al,f0h
Out
dx,al
Mov
dx,2fh
Mov
al,03h
Out
dx,al
Mov
dx,2eh
Mov
al,f1h
Out
dx,al
Mov
dx,2fh
In
al,dx
And
al,03h
Mov
ah,0ch
Or
al,ah
Out
dx,al
; Enter to extended function mode
; point to Logical Device Number Reg.
; Select Logical devive 7
;Select CRF0
;Set GP0-1 is input and GP2-3 is output
;update CRF0 with value 0Fh
;Select CRF1
;read GP0-1 value
;Set GP2-3 value is "xxxx11xxb"
; update CRF1 with value
64

Advertisement

Table of Contents
loading

Table of Contents