Gpio Sample Code - C&T Solution VCO-6000-ADL User Manual

Machine vision computer
Table of Contents

Advertisement

Appendix – WDT & GPIO

GPIO Sample Code

GPIO Setting
The GPIO function is provided by Nuvoton M058SSAN , and it can be accessed through Smbus/I2C port.
The configuration on the VCO-6000 –ADL is described as below.
Psuedo Code
#define GPI_ADDR 0x02
#define GPO_ADDR 0x01
#define Slave_ADDR 0x80
//Set OUT1~OUT8 Value
Bit 7
Bit 6
Bit 5
OUT8
OUT7
OUT6
//Set GPO to 0x55
//set IO_DO1,IO_DO3,IO_DO5,IO_DO7 to high; Set IO_DO2,IO_DO4,IO_DO6,IO_DO8 to Low
SmbusWrite (Slave_ADDR, GPO_ADDR, 0x55);
// Read In1~In8 value
Bit 7
Bit 6
Bit 5
IN8
IN7
IN6
Data= SmbusReads (Slave_ADDR, GPI_ADDR); //Read In1~In8 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
// Define Input port Address
// Define Output port Address
//Slave Address = 0x80( 7-bit address)
Bit 4
Bit 3
OUT5
OUT4
Bit 4
Bit 3
IN5
IN4
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 2
Bit 1
Bit 0
OUT3
OUT2
OUT1
Bit 2
Bit 1
Bit 0
IN3
IN2
IN1
VCO-6000-ADL l User's Manual
117

Advertisement

Table of Contents
loading

Table of Contents