HIL Read Write HIL Write Analog navigation bar

Table of Contents

HIL Write

Writes to the specified channels immediately.

Library

QUARC Targets/Data Acquisition/Generic/Immediate I/O

MATLAB Command Line

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

qc_open_library('quarc_library/Data Acquisition/Generic/Immediate I//O')

Description

HIL Write

The HIL Write block writes to the specified channels every time the block is executed. This block can write to more than one type of channel at the same time. The channels are written to immediately. Using this block is more efficient than using separate blocks for each channel type when more than one type of channel is being written.

Warning All the channels which will be used as digital outputs must be entered in the Digital output channels field of the Digital Outputs pane in the HIL Initialize block's parameters dialog. Doing so ensures that those channels will be configured as outputs when using a card for which the digital I/O lines are programmable as inputs or outputs. Failure to configure these channels in the Digital output channels field as outputs may result in the HIL Write block failing to write those outputs.

Helpful Hints

Using ESCs

Hint For producing outputs compatible with electronic speed controllers (ESCs), the ESC Output block may be used to convert a throttle value to a PWM output value.

Input Ports

The number of input ports depends on the Vector inputs parameter. If this option is checked then there is one input port for each type of channel specified. Each of these inputs is a vector containing the measurements to write to the channels specified in the corresponding Channels parameter. The first input port will be for the analog channels, if used, the next port will be for the encoder channels, if used, etc.

Otherwise there is one input port for each channel and each port reads the value to write to the corresponding channel. The first set of input ports will be for the analog channels, if used, the next set of input ports will be for the encoder channels, if used, etc. Refer to the documentation on the Vector input parameter below for more details.

Output Ports

This block has no output ports.

Data Type Support

The HIL Write block supports any of the built-in Simulink datatypes except fixed point.

Parameters and Dialog Box

HIL Write

Board Name

The name of the board whose channels will be written. Boards are configured using the HIL Initialize block. Place an HIL Initialize block in your diagram to add a board name to the list.

Analog channels

The analog channels to write. The number of analog channels available depends on the board selected. Refer to Channels for more information. The input is the voltages to write to the analog outputs.

Select a board type from the list for board-specific details:

PWM channels

The PWM channels to write. The number of channels available depends on the board selected. Refer to Channels for more information. The input is the duty cycles, frequencies or periods to write to the PWM outputs. The interpretation of the input depends on the PWM output mode set in the PWM output mode parameter of the HIL Initialize block.

Select a board type from the list for board-specific details:

Digital channels

The digital channels to write. The number of channels available depends on the board selected. Refer to Channels for more information. The input is the states to write to the digital outputs.

Select a board type from the list for board-specific details:

Other channels

The other channels to write. The number of channels available depends on the board selected. Refer to Other Channels for more information about other channels in QUARC. The input is the values to write to the other outputs.

Most boards do not support other channels. Select a board type from the list for board-specific details:

Sample time

The sample time of the block. A sample time of 0 indicates that the block will be treated as a continuous time block. A positive sample time indicates that the block is a discrete time block with the given sample time.

A sample time of -1 indicates that the block inherits its sample time from the input. The block inherits the sample time by default.

To set the sample time to the fundamental sampling time of the model, use the qc_get_step_size function, which is a QUARC function that returns the fundamental sampling time of the model. The fundamental sampling time of the model is the sampling time entered in the Fixed step size field of the Solver pane of the Configuration parameters.

Vector inputs

If this option is checked then the block will have a vector input for each type of channel specified with one element in the vector for each channel of that type. The values written to each channel must appear in the vector in the same order as the channels in the corresponding Channels parameter. For example, if analog channels 3 and 4 are selected, then the first input port will be a 2-vector with the first element containing the voltages to write to analog output 3 and the second element containing the voltages to write to analog output 4. Each input port will be labeled with the prefix indicating the type of channel represented by that input port. Refer to the table below for an explanation of the prefixes used.

If this option is not checked then the block will have one input for each channel. The input ports will appear in the same order as the channels in the corresponding Channels parameter. Each port will be labeled with a prefix indicating the channel type and the corresponding channel number.The prefixes are:

Prefix

Channel Type

a

analog

p

PWM

d

digital

o

other

Targets

Target Name

Compatible*

Model Referencing

Comments

QUARC Win32 Target

Yes

Yes

QUARC Win64 Target

Yes

Yes

QUARC Linux Nvidia Target

Yes

Yes

QUARC Linux QBot Platform Target

Yes

Yes

QUARC Linux QCar 2 Target

Yes

Yes

QUARC Linux QDrone 2 Target

Yes

Yes

QUARC Linux Raspberry Pi 3 Target

Yes

Yes

QUARC Linux Raspberry Pi 4 Target

Yes

Yes

QUARC Linux RT ARMv7 Target

Yes

Yes

QUARC Linux x64 Target

Yes

Yes

QUARC Linux DuoVero Target

Yes

Yes

QUARC Linux DuoVero 2016 Target

Yes

Yes

QUARC Linux Verdex Target

Yes

Yes

Partially supported. Only the digital channels are supported.

QUARC QNX x86 Target

Yes

Yes

Last fully supported in QUARC 2018.

Rapid Simulation (RSIM) Target

Yes

Yes

S-Function Target

No

N/A

Old technology. Use model referencing instead.

Normal simulation

Yes

Yes

Due to safety and liability concerns, the hardware may not be accessed during normal simulation.

* Compatible means that the block can be compiled for the target.

See Also

 

navigation bar