beautypg.com

D.2 gpio sample code, Gpio sample code, Appendix d w atchdog timer and gpio sample code – Advantech PCM-3362 User Manual

Page 85

background image

77

PCM-3362 User Manual

Appendix D

W

atchdog

Timer

and

GPIO

sample

code

END

D.2

GPIO sample code

;===============================================================
; Get Number of GPIO group
; one group mean 8 gpio pins (one GPIO Chip)
; Input:
; ax=5E87h
; bh=00h
; output:
; ax=5E78 ;function success, other value means function fail
; cl= n group of gpio

mov ax,5E87h
mov bh,00h
INT15

;

You will get cl=01 in 8 bit GPIO product, cl = 02 in 16 bit GPIO product

;===============================================================
;===============================================================
; Get GPIO Config
; Input:
; ax=5E87h
; bh=01h
; cl= n ; n means which group of GPIO you want to get
; output:
; ax=5E78 ;function success, other value means function fail
; bl= the n group of gpio config
; bit 0 = gpio 0 , 0 => output pin; 1 => input pin
; bit 1 = gpio 1 , 0 => output pin; 1 => input pin
; .....
; bit 7 = gpio 7 , 0 => output pin; 1 => input pin

mov ax,5E87h
mov bh,01h
mov cl,01h
INT15

;

You will get GPIO default setting from bl

;===============================================================
;===============================================================
; Set GPIO Config
; Input:
; ax=5E87h
; bh=02h