HIL Initialize HIL Set Property navigation bar

Table of Contents

HIL Set Encoder Counts

Sets the counter values for the specified encoder channels.

Library

QUARC Targets/Data Acquisition/Generic/Configuration

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/Configuration')

Description

HIL Set Encoder Counts

The HIL Set Encoder Counts block sets the counter values of the specified encoder channels every time the block is executed. The count values are written immediately. The new counter values may be specified internally via the dialog box or via an external input. This block is useful for homing a robot or other device. It is typically used in a Triggered Subsystem so that the encoder counts are only set when a particular event occurs.

Input Ports

The number of input ports depends on the Counter values source and Vector input parameters. If the source is set to be internal, then there are no input ports for the block because the counter values are specified via the Counter values parameter of the block.

If the source is set to external, then the number of input ports depends on the Vector input parameter. If this option is checked then the input is a vector containing the counter values to write to the channels specified in the Channels parameter. Otherwise there is one input port for each channel and each port contains the counter value to write to the corresponding channel. 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 Set Encoder Counts block accepts signals of any of the built-in Simulink data types. Fixed point is not supported.

Parameters and Dialog Box

HIL Set Encoder Counts

Board name

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

Channels

The encoder channels to set. The number of channels available depends on the board selected. Refer to Channels for more information.

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

Count values source

The source of the counter values to write to the encoder channels. If this option is set to internal then the Count values parameter will be used as the source of the counter values. The counter values for each channel should appear in the vector in the same order as the channels in the Channels parameter.

If this option is set to external then the Counter values parameter is not used. Instead the counter values are supplied at the inputs to the block. Refer to the Vector input parameter for details.

Count values

The counter values to write to the encoder channels. The counter values for each channel should appear in the vector in the same order as the channels in the Channels parameter. This parameter is ignored if the Count values source parameter is set to external.

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 sample time must be inherited when the block is placed in a conditionally executed subsystem like the Triggered Subsystem block.

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 input

If this option is checked then the block will have a single vector input with one element in the vector for each channel. The counter values for each channel should appear in the vector in the same order as the channels in the Channels parameter.

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 Channels parameter. Each port will be labeled with the corresponding channel number.

This parameter is ignored if the Count values source parameter is set to internal.

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

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

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

See Also

 

navigation bar