Gpio Example Program - Advantech MIC-7500 User Manual

Embedded ipc
Table of Contents

Advertisement

B.1.2

GPIO Example Program

------------------------------------------------------------
Enter the extended function mode, interruptible double-write
------------------------------------------------------------
MOV DX, 2EH
MOV AL, 87H
OUT DX, AL
OUT DX, AL
------------------------------------------------------------
Configure logical device 7(GP10~GP17), configuration register CRE4,CRE5,CRE6
------------------------------------------------------------
MOV DX, 2EH
MOV AL, 07H ; Point to Logical Device Number Reg.
OUT DX, AL
MOV DX, 2FH
MOV AL, 07H ; Select logical device 7
OUT DX, AL
------------------------------------------------------------
Configure GPIO1 I/O Register
------------------------------------------------------------
MOV DX, 2EH
MOV AL, E4H
OUT DX, AL
MOV DX, 2FH
MOV AL, ??H ; 0: The respective GPIO1 PIN is programmed as an output port
;1: The respective GPIO1 PIN is programmed as an input port.
OUT DX, AL
------------------------------------------------------------
Configure GPIO1 Inversion Register
------------------------------------------------------------
MOV DX, 2EH
MOV AL, E6H
OUT DX, AL
MOV DX, 2FH
MOV AL, 00H ; Set GPIO is normal not inverter
OUT DX, AL
------------------------------------------------------------
Configure GPIO1 Data Register
------------------------------------------------------------
MOV DX, 2EH
MOV AL, E5H
OUT DX, AL
MOV DX, 2FH
MOV AL, ??H ; Put the output value into AL
OUT DX, AL
------------------------------------------------------------
Exit extended function mode |
------------------------------------------------------------
MOV DX, 2EH
MOV AL, AAH
OUT DX, AL
79
MIC-7500 User Manual

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mic7500-s9a1eMic7500-u0a1

Table of Contents