ENDAT-GX201 USER’S MANUAL
UNICORN COMPUTER CORP.
27
void init(unsigned char flag,unsigned char time)
{
unsigned
char
tmp0;
outportb(RUNTIME_RWDT_GP60_TYPE_OFFSET,0x0d); //Disable
WDT
function
(set it as input).
tmp0=inportb(RUNTIME_RWDT_TIME_OUT_OFFSET);
if
(flag)
{
tmp0=tmp0|0x80;
//Set time unit is second.
}
else
{
tmp0=tmp0&0x7f;
//Set time unit is minute.
}
outportb(RUNTIME_RWDT_TIME_OUT_OFFSET,tmp0);
outportb(RUNTIME_RWDT_VAL_OFFSET,time);
//Set time out vlaue.
tmp0=inportb(RUNTIME_RWDT_CFG_OFFSET);
tmp0=tmp0|0x06;
outportb(RUNTIME_RWDT_CFG_OFFSET,tmp0);
//Set WDT interrupt by KB and
MOUSE.
}
void title(void)
{
cout<<"\nUNICORN COMPUTER Corp,. 2006/09/14(ver:0.1 beta)";
cout<<"\nDesigned by Robert Liou for testing WDT on GX2v1!\n\n";
}
unsigned char dec2hex(unsigned int number)
{
unsigned
char
tmp_num0,tmp_num1;
if(number>=255)
{
tmp_num0=number&0xff;
}
else
{
tmp_num1=(number/16)&0x0f;
tmp_num1=tmp_num1<<4;
tmp_num0=number%16;
tmp_num0=tmp_num0|tmp_num1;
}
return(tmp_num0);
}
ENDAT-GX201 USER’S MANUAL
UNICORN COMPUTER CORP.
28
2-6. Digital I/O
z
16 Bits Digital I/O (CN7)
I/O type: Unidirectional for 8 bits input and 8 bits output with buffer
Pin definition:
CN7: DIGITAL I/O Pin Header (2x13 with 2.0mm)
Pin No.
H/W
S/W
Pin No.
H/W
S/W
1
OUTPUT-0 BIT0
2
OUTPUT-4 BIT4
3
OUTPUT-1 BIT1
4
OUTPUT-5 BIT5
5
OUTPUT-2 BIT2
6
OUTPUT-6 BIT6
7
OUTPUT-3 BIT3
8
OUTPUT-7 BIT7
9
GND N/A
10
+5V N/A
11
+12V N/A
12
+3.3V N/A
13
GND N/A
14
KEY N/A
15
+3.3V N/A
16
+12V N/A
17
+5V N/A
18
GND N/A
19
INPUT-0 BIT0
20
INPUT-4 BIT4
21
INPUT-1 BIT1
22
INPUT-5 BIT5
23
INPUT-2 BIT2
24
INPUT-6 BIT6
25
INPUT-3 BIT3
26
INPUT-7 BIT7
Operating condition:
Due to this feature is addressing from ISA bus!
So, the ISA Bridge (IT8888G) must present on system for this feature support.
H/W jumper:
J1: DIGITAL Output Voltage Selector (CN7 only, 1x3 with 2.0mm)
Pin 1-2 *
+3.3V
Pin 3-4
+5V
S/W Port Address
: Output (0x300), Input (0x301).
Sample code
(using TurboC/C++ 3.0):
#define WRITE_OUT 0x300
//8bit I/O output
#define READ_IN 0x301
//8bit I/O input
unsigned
char
val=0;
val=inportb(READ_IN);
//Read 8 bits data from DIO port
outportb(WRITE_OUT,val);
//Write 8 bits data to DIO port