Gpio Sample Code - C&T Solution VCO-6131E-4M2 User Manual

Superior fanless embedded system
Table of Contents

Advertisement

Appendix – WDT & GPIO

GPIO Sample Code

GPIO Setting
The GPIO function is provided by Nuvoton NCT6106D, and it can be accessed through its GPIO index/data port. To access the
GPIO register, write index to the index port, and then read/write from/to data port. The configuration on the RCO-6000 is
described as below.
Psuedo Code
#define AddrPort
#define DataPort
#define SIO_UnLock_Value
#define SIO_Lock_Value
#define SIO_LDN_GPIO
#define GPIO_Port
//Enter_Config
WriteByte (AddrPort, SIO_UnLock_Value);
WriteByte (AddrPort, SIO_UnLock_Value);
WriteByte (AddrPort, 0x07);
WriteByte (DataPort, SIO_LDN_GPIO);
//Set OUT1~OUT8Value
WriteByte (AddrPort, GPIO_Port);
WriteByte (DataPort, 0x00); //set OUT1~OUT8 value, OUT1=Bit0, OUT2=Bit1
Bit 7
OUT8
// Read In1~In8 value
WriteByte (AddrPort, 0xED);
Data= ReadByte (DataPort); //Read In1~In8 value
Bit 7
IN8
// close config mode
WriteByte (AddrPort, SIO_Lock_Value);
PIN#
GPIO#
18
XCOM-
17
XCOM+
16
OUT8
15
IN8
14
OUT7
13
IN7
12
OUT6
11
IN6
10
OUT5
9
IN5
8
OUT4
7
IN4
6
OUT3
5
IN3
4
OUT2
3
IN2
2
OUT1
1
IN1
0x2e
0x2f
0x87
0xaa
0x07
0xF1
Bit 6
Bit 5
Bit 4
OUT7
OUT6
OUT5
Bit 6
Bit 5
Bit 4
IN7
IN6
IN5
VCO-6131E-4M2 l User's Manual
Default Configuration
DIO Output8
DIO Input8
DIO Output7
DIO Input7
DIO Output6
DIO Input6
DIO Output5
DIO Input5
DIO Output4
DIO Input4
DIO Output3
DIO Input3
DIO Output2
DIO Input2
DIO Output1
DIO Input1
Bit 3
Bit 2
Bit 1
OUT4
OUT3
OUT2
Bit 3
Bit 2
Bit 1
IN4
IN3
IN2
Bit 0
OUT1
Bit 0
IN1
128

Advertisement

Table of Contents
loading

Table of Contents