beautypg.com

E.1 introduction, E.2 dio connector pinouts, E.3 assembly language example – IEI Integration PCISA-PV-D4251_N4551_D5251 User Manual

Page 141: Ntroduction, Onnector, Inouts, Ssembly, Anguage, Xample

background image

PCISA-PV-D4251/N4551/D5251 CPU Card

Page 128

E.1 Introduction

The digital I/O is used for machine control and automation.

E.2 DIO Connector Pinouts

Located in the Connectors section of this document.

E.3 Assembly Language Example

;**************************************************

; DIO Port:

0A21h[3:0] (4 Out)

;

0A22h[3:0] (4 In)

;**************************************************

;==================================================

; Get current input and output values into AL register

; AL: bit0~bit3 as output value

;

bit4~bit7 as Input value

;==================================================

mov

dx,

0A21h

; GPIO output I/O base address

in

al, dx

; Get output status

jmp

$+2

;

Wait

jmp

$+2

;

Wait

and

al,

0Fh

mov

bl, al

; Move al to bl temporarily

inc

dx

; sets dx to 0A22h

in

al, dx

; Get input status

jmp

$+2

;

Wait

jmp

$+2

;

Wait

and

al,

0Fh

rol

al, 4

; Shift input values over

or

al, bl

; Merge all results into AL

; AL: bit0~bit3 as output value

; bit4~bit7 as input value

;==================================================

; Output value (x) to GPIO

; AL: bit0~bit3 as output value

;==================================================

mov

al, 0xh

; x is the output value (0 ~ Fh)

mov

dx,

0A21h

; GPIO output I/O base address

out

dx, al

; bit0 ~ bit3 as Output value

; bit4 ~ bit7 are Reserved