User manual

PCM-4153 User Manual 66
D.1 GPIO Function: Its Call by Int15 Hook.
GPIO configuration register:
Input_Reg EQU 00h
Output_Reg EQU 01h
Inversion_Reg EQU 02h
Configure_Reg EQU 03h
--------------------------------------------------------
Bh means int15 function you want to call:
Bh = 01h ; Get GPIO config
Bh = 02h ; Set GPIO config
Bh = 03h ; Get GPIO Status
Bh = 04h ; Set GPIO Status
--------------------------------------------------------
Sample code :
;===============================================================
; Set GPIO Config
; Input:
; ax=5E87h
; bh=02h
; cl= n ; n means which group of GPIO you want to set
; 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
; output:
; ax=5E78 ;function success, other value means function fail
;===============================================================
mov ax, 5E87H ;int15 hook as 5E87H
mov bh,02h
mov cl,Configure_Reg
mov al, bl ;( bl = bit0~7 = GPIO0~7 : 0 => output pin; 1 => input pin)
call Ct_I2CWriteByte
mov ax,5E78h ;return function success
;===============================================================
; Set GPIO status
; Input:
; ax=5E87h
; bh=04h
; cl= n ; n means which group of GPIO you want to set
; bl= the n group of gpio status
; bit 0 = gpio 0 , 0 => Low; 1 => High
; bit 1 = gpio 1 , 0 => Low; 1 => High
; .....