IO113-20 - Analog Output and Digital Loopback example
This example demonstrates how to configure and use two analog output channels in single ended mode and how to perform a digital loopback on the IO113-20 I/O Module.
The IO113-20 I/O module provides 8 single-ended or 8 differential 20-bit analog outputs and 8 bidirectional digital TTL I/O lines.-
This example runs on the IO113-20 I/O Module. The I/O Modules blocks can be replaced in the model to also work with the IO113 I/O Module
Setup
Prerequisites
You will require the following to run this example:
- Speedgoat real-time target machine with one IO113-20 I/O module installed
- Connector cable from the I/O module to the terminal board
- 68-pin terminal board with jumper wires
- Oscilloscope
Test Setup
On the terminal board of the analog I/O module, connect Analog Outputs 1 and 2 to two separate channel of your lab oscilloscope, Finally, connect the digital pin as described below.
Initialize and Open the Simulink model
modelName = 'sgMdl_IO113_20_AnalogOutputDigitalLoopback';
Model Description
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
% Download and install the real-time application on the target machine
% 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
% The real-time application on the target machine will automatically stop after 10 seconds
Check the Results
By opening the scope in the simulink model you will be able to inspect the digital signals.
On your lab scope you will see the signals as configured in the simulink model
Additional References