System Installation
PEB-2131VG2A User’s Manual
3-6
PEB-2131VG2A GPIO Programming Guide
There are two PNP I/O port addresses that can be used to configure GPIO ports,
1) 0x2E -
EFER
(Extended Function Enable Register, for entering Extended Function
Mode)
-
EFIR
(Extended Function Index Register, for identifying CR index number)
2) 0x2F -
EFDR
(Extended Function Data Register, for accessing desired CR)
Below are some example codes, which demonstrate the use of GPIOs.
// Enter Extended Function Mode
outp(0x002E, 0x87);
outp(0x002E, 0x87);
// Assign Pin1-4 and Pin125-128 to be GPIO port 1
outp(0x002E, 0x29);
outp(0x002F, 0x7F);
// Select Logic Device 8
outp(0x002E, 0x07);
outp(0x002F, 0x08);
// Active GPIO 5
outp(0x002E, 0x30);
outp(0x002F, 0x03);
// Select I/O Mode
outp(0x002E, 0xE0);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
I/O Selection Register
&
0x0F));
// Select Inversion Mode
outp(0x002E, 0XE2);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
Inversion Register
&
0x0F));
// Access GPIO ports
outp(0x002E, 0XE1);
outp(0x002F, (inp(0x002F)
&
0xF0) | (
Output Data
&
0x0F));
or
Input Data
= inp(0x002F);
// Exit Extended Function Mode
outp(0x002E, 0xAA);