ENDAT-4601 USERS MANUAL
UNICORN COMPUTER CORP.
16
2-5. Digital I/O
J4 Pin define:
J4: DIGITAL I/O Pin Header (2 x 7 with 2.0mm)
Pin No.
Function
Pin No.
Function
1
+5V
2
+5V
3
DIO-O0
4
DIO-I0
5
DIO-O1
6
DIO-I1
7
GND
8
GND
9
DIO-O2
10
DIO-I2
11
DIO-O3
12
DIO-I3
13
+3.3V
14
+3.3V
Digital I/O port address:
This function is support by onboard super I/O chip; it can be control easily by
change the register of super I/O chip via I/O port “2Eh” and “2Fh”. Please see
the sample code of below for implement. Voltage tolerance: +/- 5% with 0V to
+5V.
Bit map for input:
bit
No
7 6 5 4 3 2 1 0
Map
DIO-I3 DIO-I2
DIO-I1
DIO-I0
NA NA NA NA
Sample code for input (using Turbo C/C++ 3.0)
#define input_port 0x2f // Digital input data port
Unsigned char read_data;
outportb(0x2e,0x87); //Unlock
register
outportb(0x2e,0x87); //Unlock
register
outportb(0x2e,0x07);
//set Logic Device number pointer
outportb(0x2f,0x08);
//set
Logic
Device
number
outportb(0x2e,0x30);
//set Device Active
outportb(0x2f,0x03);
// set Bit 1 =GPIO5 ; 0=Inactive / 1= Active Default: 01h
outportb(0x2e,0xE0);
// set GPIO Output / Input Port
outportb(0x2f,0xF0);
//
0=Output/
1=Input
// Bit 0~3 DIO-O0~ DIO3 / Bit4~7 DIO-I0~DIO-I3.
outportb(0x2e,0xE1);
//Read DIO-Input register.
// n=DIO-O0~DIOO3 / m=DIO-I0~DIO-I3.
//Bit7~Bit3
=
DIO-O3~DIO-O0.
read_data=inportb(input_port); // Read digital input data
printf("DIO-Input=%02X\n",read_data); //Show digital input data on screen