quarc_digital_loopback_demo.mdl
Open this model

MATLAB Command Line

Click to copy the following command line to the clipboard. Then paste it in the MATLAB Command Window:

quarc_digital_loopback_demo

QUARC Digital Loopback Demo

This example is a simple digital loopback test, but it demonstrates a number of important features of QUARC, such as the ability to access and quickly change hardware, multiple targets, online parameter tuning, data streaming, MAT-file logging, using Model Explorer and potentially more.

Analog Loopback Demo Simulink Diagram

System Requirements

This demonstration requires hardware supported by the HIL blockset, such as the Q2-USB or Q8-USB hardware-in-the-loop card.

Configuring the Demonstration

To set up the demonstration for your data acquisition card, double-click on the HIL Initialize block and select the correct board type from the Board type combo box. If you have more than one board of the same type in your computer, change the Board number field to the board you wish to use. Boards are numbered from 0 such that board 0 is the first board recognized by the HIL blockset.

Now wire digital output channel #8 to digital input channel #0. For the Q2-USB or Q8-USB hardware-in-the-loop cards, simply connect a 16-pin ribbon cable from digital header #0 (DIO0) to digital header #1 (DIO1) on the terminal board.

Demonstration

Building, deploying and starting the model

Refer to One Step Process in QUARC Basic Procedures to build, deploy and start the model.

Running the model

Double-click on the Scope block to open the Scope.

A pulse of amplitude 1 with a 50% duty cycle will appear in the Scope. Notice that the Scope trace is now moving in actual time. In other words, the trace passes the 10 second mark after 10 seconds has passed since QUARC runs the model in real-time on the QUARC target and communicate with Simulink via external mode communication.

Scope with 50% Duty Cycle Pulse of Amplitude 1

Double-click on the Pulse Generator block. Change the Pulse width parameter from 50 to 25 percent. Click OK to close the Pulse Generator dialog box. The duty cycle of the pulse trace changes to 25% to reflect the new pulse width.

Scope with 25% Duty Cycle Pulse of Amplitude 1

Stopping the model

Refer to One Step Process in QUARC Basic Procedures to stop the model.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.