Apex AD10 DI Usage#

Hardware Specification#

Pin Definition#

Function

DB9 PIN Number

Description

Device Node

DI_0

1

GPIO IN

/dev/gpio/di0

DI_1

2

GPIO IN

/dev/gpio/di1

DO_0

3

GPIO OUT

/dev/gpio/do0

DO_1

4

GPIO OUT

/dev/gpio/do1

DO_2

5

GPIO OUT

/dev/gpio/do2

GND

6-9

Ground


Function

DB9 PIN Number

Description

Device Node

DO_3

1

GPIO OUT

/dev/gpio/do3

DI_2

3

GPIO IN

/dev/gpio/di2

DI_3

5

GPIO IN

/dev/gpio/di3

GND

6/8

Ground


Electrical Characteristics#


Description

Vin

Input Voltage

GND

Ground

A

Anode

C

Cathode

Vin Voltage Range

Result

1~12V

high level=1

0~0.8V

low level=0

> 12V or < 0 V

Not supported and may damage hardware.

Method of Application#

System version below 5.x.x-x.x.x#

The example of using the GPIO interface is as follows.

# switch to root
sudo su -
# Read Data(DI)
cat /sys/class/gpio/<device node name>/value
# Example: cat /sys/class/gpio/gpio339/value

System version above 6.x.x-x.x.x#

The usage of GPIO is as below

sudo /opt/miivii/features/gpio/bin/miivii_get_di_value <DI number>
#<DI number>: Represents the sequence number of the DI. 0 represents DI0, 1 represents DI1, and so on.
#The command return value is the current level value read from the DI, where 0 represents low level and 1 represents high level.

#Example: Read the input of DI0
#sudo /opt/miivii/features/gpio/bin/miivii_get_di_value 0

Compile sample code

cp -r /opt/miivii/features ~/
cd ~/features/gpio
sudo make;