Documentation search search close
CONTENTS

    Open this example in MATLAB

v10.0.1.x for R2026a
View other versions

IO291 HighSide - Digital LVTTL and FET Loopback

This example shows you how to perform a loopback test with the IO291 HighSide I/O module to verify the LVTTL and FET digital loopback functionality of some of the input and output channels.
The IO291 is a digital module providing eight optically isolated non-polarized inputs with up to 48 VDC, eight fully protected FET output switches with 5 to 48 VDC at up to 1 A (HighSide), and eight LVTTL I/O channels programmable as inputs or outputs in groups of 4 lines.

Test Setup

Prerequisites

You will require the following to run this example:
  • Speedgoat real-time target machine with one IO291 HighSide I/O module installed
  • Connector cable from the I/O module to the terminal board
  • 1 x 2-way 17-pin M12 terminal board with jumper wires
  • External DC power supply
  • Load resistor

Loopback Wiring

This example can be used as a loopback test, where the LVTTL and FET Digital Outputs are wired back to the LVTTL and FET Digital Inputs. Select the correct load resistor value according to the DC power supply and the maximum current (1 A).
The following wiring is required:
io291_HS_Loopback_pinWiring_LVTTL_Digital.png
io291_HS_Loopback_pinWiring_FET_Digital.png
The full pin mapping of the IO291 can be found here: IO291 Pin Mapping

Open Simulink Model

modelName = 'sgMdl_IO291_HS_DigitalLoopback';
open_system(modelName); % Open Simulink model

Build, Download, and Run the Example

To run the example, either run the following code section or click the Run on Target button in the REAL-TIME tab in the Simulink model.
% Build the Simulink model
slbuild(modelName); % this will create the real-time application file (.mldatx)
 
% Create and connect to the Speedgoat real-time target machine
tg = slrealtime;
tg.connect;
 
% Download and install the real-time application on the target machine
tg.load(modelName);
 
% Connect the Simulink model with external mode to the real-time application on the target machine
set_param(modelName, 'SimulationMode', 'external') % put model into External Mode
set_param(modelName, 'SimulationCommand', 'connect') % connect with External Mode
 
% Start the real-time application
tg.start;
 
% Wait a few seconds and then stop the real-time application on the target machine
pause(10)
tg.stop;

Check the Results

Open the two Simulink scopes connected to the LVTTL and FET Digital input blocks and compare the signals to check if the loopback is working as expected. On the LVTTL and FET Scope, four pulses must be displayed:
Scope for LVTTL Digital Inputs
io291_HS_LoopbackSignal_LVTTL_Digital.png
Scope for FET Digital Inputs
io291_HS_LoopbackSignal_FET_Digital.png

Additional References