This function selectively reads the I/O channel status of a TM3 analog or temperature module, indicated by ModuleIndex. The function block writes the status for each requested channel starting at the memory location pointed to by pStatusBuffer.
To see the general representation in IL or ST language, refer to the chapter Function and Function Block Representation.
Each analog/temperature I/O channel of the requested module requires one byte of memory. If there is not sufficient memory allocated to the buffer for the number of I/O module channel statuses requested, it is possible that the function will overwrite memory allocated for other purposes, or perhaps attempt to overwrite a restricted area of memory.
WARNING | |
---|---|
The following table describes the input variables:
Input |
Type |
Comment |
---|---|---|
ModuleIndex |
BYTE |
Index of the expansion module (0 for the module closest to the controller, 1 for the second closest, and so on) |
StatusOffset |
BYTE |
Offset of the first status to be read in the status table. |
StatusSize |
BYTE |
Number of bytes to be read in the status table. |
pStatusBuffer |
POINTER TO BYTE |
Buffer containing the read status table (IBStatusIWx / IBStatusQWx). |
The following table describes the output variable:
Output |
Type |
Comment |
---|---|---|
TM3_GetModuleInternalStatus |
Returns |
The following examples describe how to get the module internal status:
VAR
TM3AQ2_Channel_0_Output_Status: BYTE;
END_VAR
TM3AQ2 is on position 1
Status of channel 0 is at offset 0
We read 1 channel
TM3_GetModuleInternalStatus(1, 0, 1, ADR(TM3AQ2_Channel_0_Output_Status));
status of channel 0 is in TM3AQ2_Channel_0_Output_Status
TM3AQ2 module (2 outputs)
Getting the status of first output QW0
StatusOffset = 0 (0 inputs x 2)
StatusSize = 1 (1 status to read)
pStatusBuffer needs to be at least 1 byte
VAR
TM3AM6_Channels_1_2_Input_Status: ARRAY[1..2] OF BYTE;
END_VAR
TM3AM6 is on position 1
Status of channel 1 is at offset 1
We read 2 consecutive channels
TM3_GetModuleInternalStatus(1, 1, 2, ADR(TM3AM6_Channels_1_2_Input_Status));
status of channel 1 is in TM3AM6_Channels_1_2_Input_Status[1]
status of channel 2 is in TM3AM6_Channels_1_2_Input_Status[2]
TM3AM6 module (4 inputs, 2 outputs)
Getting the status of input IW1 & IW2 (IW0 being the first one)
StatusOffset = 1 (1 to skip IW0 status)
StatusSize = 2 (2 statuses to read)
pStatusBuffer needs to be at least 2 bytes