System Installation
ROBO-8771VG2 User’s Manual
3-7
Below are some example codes, which demonstrate the use of GPIOs.
// Enter Extended Function Mode
outp(0x002E, 0x87);
outp(0x002E, 0x87);
// Assign Pin121-128 to be GPIO port 1
outp(0x002E, 0x2A);
outp(0x002F, 0x0FF);
// Select Logic Device 7
outp(0x002E, 0x07);
outp(0x002F, 0x07);
// Active Logic Device 7
outp(0x002E, 0x30);
outp(0x002F, 0x01);
// Select Inversion Mode
outp(0x002E, 0xF2);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
Inversion Register
&
0x0F));
// Select I/O Mode
outp(0x002E, 0xF0);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
I/O Selection Register
&
0x0F));
// Access GPIO ports
outp(0x002E, 0xF1);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
Output Data
&
0x0F));
or
Input Data
= inp(0x002F);
// Exit Extended Function Mode
outp(0x002E, 0xAA);
Definitions of Variables:
Each bit in the lower nibble of each Register represents the setting of a GPIO port.
Bit0 vs. GPIO port 1
Bit1 vs. GPIO port 2
Bit2 vs. GPIO port 3
Bit3 vs. GPIO port 4
Bit4 vs. GPIO port 5
Bit5 vs. GPIO port 6
Bit6 vs. GPIO port 7
Bit7 vs. GPIO port 8