Skip to content

Binary I/Os

In this quick-start guide we will run a demo program to stimulate and read back the SQ1-TRACK's binary I/Os.

Prerequisites

Hardware

  • A CompactPCI Serial System with a SQ1-TRACK installed
  • A development PC (Windows or Linux), connected via Network to the CPCI Serial System
  • Networking for Ethernet-over-USB has been setup, so that the host can reach the SQ1-TRACK. See CPCI-S.0 Linux Networking

  • A laboratory power supply to provide a voltage to feed the binary I/Os

Tools on Development PC

The examples are written in programming language Go, we download the go sources and compile them. Therefore we need some tools on your development PC:

Get Demo Software

Clone the repository containing the examples to a folder of your choise (here myworkdir).

c:
cd \myworkdir
git clone https://github.com/ci4rail/io4edge-client-go.git
cd io4edge-client-go
cd ~/myworkdir
git clone https://github.com/ci4rail/io4edge-client-go.git
cd io4edge-client-go

Determine the Service Address of your SQ1-TRACK

Io4Edge Devices are usually addressed by their service address, which is a name in the network.

The SQ1-TRACK's service name depends on the geographical slot address and is usually SQ1-geo_addr-<geo-address>[-<function>], i.e. if the SQ1-TRACK is in the slot with geographical address 04, we have the following service names:

Service Name Description
SQ1-geo_addr04 Core function
SQ1-geo_addr04-binio Binary I/O function
SQ1-geo_addr04-audiorelay 24V Binary Output function

We need this service address in the demo programs to address the module, for example SQ1-geo_addr04-binio.

If you are unsure, you can also browse the available devices:

io4edge-cli scan -f

If your SQ1-TRACK is in the slot with geographical address 04, the output should be:

DEVICE ID       SERVICE TYPE                    SERVICE NAME                    IP:PORT
SQ1-geo_addr04  _io4edge-core._tcp              SQ1-geo_addr04                  192.168.205.1:9999
                _io4edge_binaryIoTypeD._tcp     SQ1-geo_addr04-binio            192.168.205.1:10000
                _io4edge_binaryIoTypeB._tcp     SQ1-geo_addr04-audiorelay       192.168.205.1:10001

Binary I/O Demo

For the binary I/O deme we connect two I/Os and use one of them as output to stimulate the other one which is used as input. We will then toggle the output and read back the input.

Connecting

Plug a mating connector Phoenix DFMC 1.5/ 3-STF-3.5 6-pin P/N 1790302 to the 1st binary I/O connector from the top of the SQ1-TRACK.

Connect the V+ and V+ pins to your laboratory power supply which is set to a voltage of 24 V.

Connect I/O 1 to I/O 2 with a jumper wire.

Connection for Binary I/O Demo

Demo Software

Compile Demo

Run this in a powershell console

cd examples\binaryIoTypeD\blinky
$Env:GOOS = "linux"
$Env:GOARCH = "amd64"
go build
cd examples/binaryIoTypeD/blinky
GOOS=linux GOARCH=amd64 go build

This produces the binary file blinky in the current folder.

Copy Demo to CompactPCI Serial CPU

Transfer the compiled binary. Replace <target-ip> with the IP address of your CompactPCI Serial CPU.

scp blinky <target-ip>:~/.

Running the Demo

Login into your CompactPCI Serial CPU over SSH:

ssh <target-ip>

Once logged in into the CompactPCI Serial CPU's Shell, run the demo.

./blinky -channels 2 SQ1-geo_addr04-binio
You should see now see LED 1 and LED 2 blinking green.

And the output should be:

Errors so far: 0
Errors so far: 0
...