0122-22 LED Snake EMO-1WR4DI4

Example Projects > 0122 UniPi 1.1 > 0122-22 LED Snake EMO-1WR4DI4

Controlling relay outputs and reading digital inputs of the EMO-1WR4DI4

This folder contains the source files for the demonstration project on using the UniPi extension board and the EMO-1WR4DI4 1-Wire board in the REXYGEN System.

The relays of UniPi itself and the relays of the EMO-1WR4DI4 board are synchronized in a demo algorithm, which illustrates seamless integration of various I/O devices using REXYGEN.

The ATMT state automaton cycles through 4 states to gradually increase the speed of the "LED snake". The appropriate pulse generator is selected according to the ATMT automaton state. The generated pulses move the snake bit by bit (literally

  • bitwise shift to left is used).

Digital inputs of the EMO-1WR4DI4 board are read and recorded in the TRND blocks which allow displaying of the trends (graphs) in the REXYGEN Diagnostics diagnostic tool.

As a side effect, the status of the relays is read along the status of the digital inputs. This can be used for verification.

Timing of the project

The algorithm runs each 20 milliseconds (0.02 s). See the EXEC function block,
tick x ntick0 = 0.02 x 1 = 0.02

Prerequisites

  • REXYGEN Runtime Core and RPiDrv modules must be installed and running on the Raspberry Pi.
  • Owserver (part of the OWFS package) must be installed, correctly configured and running on the Raspberry Pi.
  • I2C bus must be enabled on the Raspberry Pi.
  • The EMO-1WR4DI4 relay board must be connected.

Running the example

  • The *exec.mdl file is the project main file, open it with REXYGEN Studio.
  • Specify the 64-bit ROM ID of the EMO-1WR4DI4 board. See the 1-Wire driver manual below.
  • Compile and download the project to the target device.

Documentation

Additional information