Reading TriggerStatus from Chunk Data
refering to the previous post from @Arno on Reading Chunk Data, reading the “TriggerStatus” is a bit tricky.
TriggerStatus is defined as:
public byte TriggerStatus;
While TriggerStatus is an 8-bit value it contains the information of 6 elements:
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_TRIGGER_OVERRUN
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_RESOLVER_CNT_UP
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_IN0
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_IN1
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_OUT0
#define CHUNKACQINFO_TRIGGERSTATUS_BIT_OUT1
Extracting the information from TriggerStatus as byte will result in a decimal value between 0 ant 255.
From this the information on the 6 status elements can already be read unambiguous. For interpretation reasons it might be easier to convert the decimal number to a binary number.
In our example we receive that decimal byte value of 193 from the TriggerStatus Chunk value.
Decoded to binary the value can be read like this:
11000001
Each bit is now describing the status of one of the 6 elements. The logic is set to the following:
Out1 = high, Out0 = high, In1 = low, In0 = low, -, -, EncoderStatus = off/back, TriggerOverrun = true.
The EncoderStatus is described by the following:
- If no Encoder is used: EncoderStatus = 0
- If an Encoder is used:
- Encoder Status = 0: Encoder is moving backward.
- Encoder Status = 1: Encoder is moving forward.