User manual

71 PCM-3343 User Manual
Appendix C Watchdog Timer and GPIO Sample Code
C.1.2 [PCM-3343 GPIO]
1. GPIO Registers
IO port 98h: GPIO 0 Direction register (0 = Input / 1= Output).
IO port 99h: GPIO 1 Direction register (0 = Input / 1= Output).
IO port 78h: GPIO data port 0 base address (0 = Low / 1 = High).
IO port 79h: GPIO data port 1 base address (0 = Low / 1 = High).
2. Sample Code
.model small
.286p
.stack
.data
.code
main:
mov dx, 98h ;GPIO 0 Direction port
mov al, 0FFh ;Set GPIO 0 of 0 ~ 7 as output type.
out dx, al
inc dx ;Set 99h GPIO 1 Direction port
out dx, al ;Set GPIO 1 of 0 ~ 7 as output type.
mov dx, 78h ;GPIO data port 0 base address
mov al, 55h ;Set GPIO 0 of GPIO 0, 2, 4, 6 as high, 1, 3, 5, 7 as low.
out dx, al
inc dx ;Set GPIO data port 1 base address
mov al, 0AAh ;Set GPIO 1 of GPIO 1, 3, 5, 7 as high, 0, 2, 4, 6 as low.
out dx, al
mov ah,4ch
int 21
end