ioPAC RTU Controllers
C/C++ Sample Code Programming Guide
Modules | Functions
AI

Modules

 AI_RANGE
 
 AI_STATUS
 
 AI_ENABLE_MODE
 

Functions

AI_TRANSFORM_ERR_CODE MX_RTU_AI_Raw_to_Eng (UINT32 range, int rawValue, float *engValue)
 
AI_TRANSFORM_ERR_CODE MX_RTU_AI_Eng_to_Raw (UINT32 range, float engValue, int *rawValue)
 
AIO_TRANSFORM_ERR_CODE MX_RTU_AIO_Raw_to_Eng (UINT32 range, UINT32 bitsResolution, int rawValue, float *engValue)
 
AIO_TRANSFORM_ERR_CODE MX_RTU_AIO_Eng_to_Raw (UINT32 range, UINT32 bitsResolution, float engValue, int *rawValue)
 
void MX_RTU_AI_Raw_to_Eng_0_10V (int rawValue, float *engValue)
 
void MX_RTU_AI_Raw_to_Eng_4_20mA (int rawValue, float *engValue)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Raw_Value_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf, struct Timestamp *time)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Eng_Value_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf, struct Timestamp *time)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Range_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Raw_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Raw_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Eng_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Eng_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Burnout_Value_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Status_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Range_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Raw_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Raw_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Eng_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Eng_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Burnout_Value_Set (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 

Detailed Description

Sample Code:
ai.c

Function Documentation

AI_TRANSFORM_ERR_CODE MX_RTU_AI_Raw_to_Eng ( UINT32  range,
int  rawValue,
float *  engValue 
)
Parameters
[in]rangeAI range
[in]bitsResolutionThe resolution of a n-bit.
[in]rawValueThe raw value to transform.
[out]engValueThe engineering value transformed form the input raw_value.
Returns
AI_TRANSFORM_ERR_CODE
AI_TRANSFORM_ERR_CODE MX_RTU_AI_Eng_to_Raw ( UINT32  range,
float  engValue,
int *  rawValue 
)
Parameters
[in]rangeAI range
[in]bitsResolutionThe resolution of a n-bit.
[in]engValueThe engineering value to transform.
[out]rawValueThe raw value transformed form the input eng_value.
Returns
AI_TRANSFORM_ERR_CODE
AIO_TRANSFORM_ERR_CODE MX_RTU_AIO_Raw_to_Eng ( UINT32  range,
UINT32  bitsResolution,
int  rawValue,
float *  engValue 
)
Parameters
[in]rangeAI range
[in]bitsResolutionThe resolution of a n-bit.
[in]rawValueThe raw value to transform.
[out]engValueThe engineering value transformed form the input raw_value.
Returns
AIO_TRANSFORM_ERR_CODE
AIO_TRANSFORM_ERR_CODE MX_RTU_AIO_Eng_to_Raw ( UINT32  range,
UINT32  bitsResolution,
float  engValue,
int *  rawValue 
)
Parameters
[in]rangeAI range
[in]bitsResolutionThe resolution of a n-bit.
[in]engValueThe engineering value to transform.
[out]rawValueThe raw value transformed form the input eng_value.
Returns
AIO_TRANSFORM_ERR_CODE
void MX_RTU_AI_Raw_to_Eng_0_10V ( int  rawValue,
float *  engValue 
)
Parameters
[in]rawValueThe raw value to transform.
[out]engValueThe engineering value transformed form the input raw value.
void MX_RTU_AI_Raw_to_Eng_4_20mA ( int  rawValue,
float *  engValue 
)
Parameters
[in]rawValueThe raw value to transform.
[out]engValueThe engineering value transformed form the input raw value.
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Raw_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf,
struct Timestamp time 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe AI raw data for the corresponding channels.
[out]timeTimestamp of AI data.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Eng_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf,
struct Timestamp time 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe AI engineering data for the corresponding channels.
[out]timeTimestamp of AI data.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Range_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe AI range for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Raw_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe minimal AI raw data that have occurred for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Raw_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe maximal AI raw data that have occurred for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Eng_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe minimal AI engeering data that have occurred for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Eng_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe maximal AI engeering data that have occurred for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Burnout_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe burnout value for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
Note
These values are valid only when the AI range is 4-20mA
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Status_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe AI status for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
Note
These values are valid only when the AI range is 4-20mA
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Range_Set ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to set.
[in]countThe number of channels to set.
[in]bufThe AI range for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Raw_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]channelReset the minimal AI raw data that have occurred for the specified channel. The bit 0 represents channel 0 will be reset and so on.
Returns
MODULE_RW_ERR_CODE
Note
This API only reset the RAW value, reset is setting the Min value to be current value.
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Raw_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]channelReset the maximal AI raw data that have occurred for the specified channel. The bit 0 represents channel 0 will be reset and so on.
Returns
MODULE_RW_ERR_CODE
Note
This API only reset the RAW value, reset is setting the Max value to be current value.
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Min_Eng_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]channelReset the minimal AI engeering data that have occurred for the specified channel. The bit 0 represents channel 0 will be reset and so on.
Returns
MODULE_RW_ERR_CODE
Note
This API only reset the ENG value, reset is setting the Min value to be current value.
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Max_Eng_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]channelReset the maximal AI engeering data that have occurred for the specified channel. The bit 0 represents channel 0 will be reset and so on.
Returns
MODULE_RW_ERR_CODE
Note
This API only reset the ENG value, reset is setting the Max value to be current value.
MODULE_RW_ERR_CODE MX_RTU_Module_AI_Burnout_Value_Set ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotslot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
[in]startThe first channel to set.
[in]countThe number of channels to set.
[in]bufThe burnout value for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
Note
These values are valid only when the AI range is 4-20mA