Home
Configure Encoder I/O Counter Time Base

Read Encoder Flags

Reads the encoder flags for the specified channels. These flags are not the interrupt flags but the contents of the encoder status register.

Library

qctools

Description




The Read Encoder Flags block for the Q8 series of I/O cards provides a mechanism for reading the status registers associated with a set of encoder channels. Reading the status register allows all the information about a particular encoder channel, or set of encoder channels, to be read simultaneously, rather than using the interrupt flags, for which only two are available at one time. Also, more information is available from the status registers.

Block Outputs

BT

The borrow toggle flip-flop. This output toggles each time the counter underflows ie., whenever the count value cycles from 0 to 16777215 (0xffffff ), counting downward.

CT

The carry toggle flip-flop. This output toggles each time the counter overflows ie., whenever the count value cycles from 16777215 (0xffffff ) to 0, counting upward.

CPT

The compare toggle flip-flop. This output toggles each time the counter equals the preload value (the Initial Value setting of an Encoder Input block or Reset Value setting of an Encoder Reset block)

S

The sign flag. This output reflects the sign bit of the 24-bit count value (bit 23 – the most significant bit).

E

The error flag. This output is set to 1 when excessive noise is present at the encoder inputs.

U/D

The up/down flag. This output is set to 1 when the encoder is counting up and set to 0 when it is counting down.

IDX

The index flag. This output is set to 1 when the index is valid. Note that this input is always 0 if the index is disabled (see the Encoder Input block's Enable Index option).

Parameters and Dialog Box




Board Number

The board number of the I/O card. If there is only one Q8 board in your system, then the board number should be zero. The second Q8 board in your system is board number 1, etc.

Channel(s) to Read

The channels whose status flags are to be read. If a vector is specified, then each output is a vector of the same length. For example, if there are 3 channels, then the entry [4,2,0] assigns element 1 to encoder input 4, element 2 to encoder input 2 and element 3 to encoder input 0. The channel numbers may range from 0 to 7, since there are 8 encoder channels on the Q8 I/O boards.

Sample Time

A sample time must be specified for all discrete blocks. The default value extracts the sample time from the RTW Options dialog, under Solver/Fixed step size. A numeric value rather than 'auto' should be specified in this dialog field for this default to make sense.

       
Configure Encoder I/O Counter Time Base