Download User Manual - data
Transcript
2. GPIO Sample Code 1. GPIO function: The SCH3114 Runtime base I/O address is A00h .model small .486p .stack 256 .data SCH3114_IO EQU A00h .code org 100h .STARTup ;==================================================== ;GIPO 0~GPIO 7 Function define(SCH3114_IO Port offset + 23h / 24h / 25h / 26h / 27h / 29h / 2Ah / 2Bh) ; bit [0] = In/Out: = 1 Input, = 0 output ; bit [1] = Polarity : 1 Invert, = 0 No Invert ; bit [7] = Output Type Select : 1 = Open Drian, 0 = Push Pull ;==================================================== mov dx,SCH3114_IO + 23h ;GPIO 0 mov al,00h ;program GPIO 0 as output out dx,al ;==================================================== ;GIPO 0~GPIO 7 DATA Register (SCH3114_IO Port offset + 4Bh) ; bit [0] = GPIO 0 High/Low: = 1 High, = 0 Low ; bit [1] = GPIO 1 High/Low: = 1 High, = 0 Low ; bit [2] = GPIO 2 High/Low: = 1 High, = 0 Low ; bit [3] = GPIO 3 High/Low: = 1 High, = 0 Low ; bit [4] = GPIO 4 High/Low: = 1 High, = 0 Low ; bit [5] = GPIO 5 High/Low: = 1 High, = 0 Low ; bit [6] = GPIO 6 High/Low: = 1 High, = 0 Low ; bit [7] = GPIO 7 High/Low: = 1 High, = 0 Low ;==================================================== mov dx,SCH3114_IO + 4Bh ; mov al,01h ;Set GPIO 0 as High level out dx,al .exit 71 MIO-2260 User Manual Data Modul AG - www.data-modul.com Appendix B WDT & GPIO ;WD timer counting = 0 ;==================================================== mov dx,SCH3114_IO + 68h mov al,01h out dx,al .exit END