ioPAC RTU Controllers
C/C++ Sample Code Programming Guide
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
FAST_AI

Macros

#define FAST_AI_BATCH_DATA_SIZE   60*1000
 

Functions

MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Raw_Value_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf, struct Timestamp *time)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Eng_Value_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf, struct Timestamp *time)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Range_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Min_Raw_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Max_Raw_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Min_Eng_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Max_Eng_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Burnout_Value_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Status_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Range_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Min_Raw_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Max_Raw_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Min_Eng_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Max_Eng_Reset (UINT8 slot, UINT32 channel)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Burnout_Value_Set (UINT8 slot, UINT8 start, UINT8 count, float *buf)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Sampling_Rate_Get (UINT8 slot, UINT32 *rate)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Buf_Overflow_Get (UINT8 slot, UINT32 *overflow)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Batch_Data_Get (UINT8 slot, UINT32 channel, UINT32 fore_interval, UINT32 back_interval, UINT8 *buf, struct Timestamp *time)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Sampling_Rate_Set (UINT8 slot, UINT32 rate)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Buf_Overflow_Reset (UINT8 slot, UINT32 overflow)
 
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Trigger_Set (UINT8 slot, UINT32 channel_trigger, UINT32 fore_interval, UINT32 back_interval, UINT32 *required_buf_size)
 

Detailed Description

Sample Code:
fast_ai.c

Macro Definition Documentation

#define FAST_AI_BATCH_DATA_SIZE   60*1000

Function Documentation

MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Raw_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf,
struct Timestamp time 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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_Fast_AI_Eng_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf,
struct Timestamp time 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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_Fast_AI_Range_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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_Fast_AI_Min_Raw_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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_Fast_AI_Max_Raw_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT32 buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe maximum AI raw data for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Min_Eng_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe minimum AI engineering data for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Max_Eng_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]startThe first channel to get.
[in]countThe number of channels to get.
[out]bufThe maximum AI engineering data for the corresponding channels.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Burnout_Value_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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-20 mA.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Status_Get ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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-20 mA.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Range_Set ( UINT8  slot,
UINT8  start,
UINT8  count,
UINT8 buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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_Fast_AI_Min_Raw_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channelReset the minimum AI raw data 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_Fast_AI_Max_Raw_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channelReset the maximum AI raw data 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_Fast_AI_Min_Eng_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channelReset the minimum AI engineering data 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_Fast_AI_Max_Eng_Reset ( UINT8  slot,
UINT32  channel 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channelReset the maximum AI engineering data 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_Fast_AI_Burnout_Value_Set ( UINT8  slot,
UINT8  start,
UINT8  count,
float *  buf 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: 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-20 mA.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Sampling_Rate_Get ( UINT8  slot,
UINT32 rate 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[out]rateThe sampling rate of the fast AI channel.
Returns
MODULE_RW_ERR_CODE
Note
The range of sampling rates is [1-5000] Hz.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Buf_Overflow_Get ( UINT8  slot,
UINT32 overflow 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[out]overflowA bitwise value to indicate all channels' overflow status. The value for bit 0 indicates whether or not channel 0's buffer is overflowed (0: OK, 1: overflow).
Returns
MODULE_RW_ERR_CODE
Note
If the buffer is overflowed, the fast AI will not work.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Batch_Data_Get ( UINT8  slot,
UINT32  channel,
UINT32  fore_interval,
UINT32  back_interval,
UINT8 buf,
struct Timestamp time 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channelThe channel to get.
[in]fore_intervalThe pre-recording time before the trigger time (one unit = 1sec).
[in]back_intervalThe recording time after the trigger time (one unit = 1sec).
[out]bufThe batch of AI raw data.
[out]timeTimestamp of the first AI data.
Returns
MODULE_RW_ERR_CODE
Note
Before executing this API, the channel must be triggered by MX_RTU_Module_Fast_AI_Trigger_Set . The maximum buffer size refers to FAST_AI_BATCH_DATA_SIZE .
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Sampling_Rate_Set ( UINT8  slot,
UINT32  rate 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]rateThe sampling rate of the fast AI channel.
Returns
MODULE_RW_ERR_CODE
Note
The range of sampling rates is [1-5000] Hz.
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Buf_Overflow_Reset ( UINT8  slot,
UINT32  overflow 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]overflowA bitwise value to specify that the channel's buffer and overflow flag to be reset. If bit 0's value is 1, then channel 0's buffer and buffer overflow flag will be reset, and so on.
Returns
MODULE_RW_ERR_CODE
MODULE_RW_ERR_CODE MX_RTU_Module_Fast_AI_Trigger_Set ( UINT8  slot,
UINT32  channel_trigger,
UINT32  fore_interval,
UINT32  back_interval,
UINT32 required_buf_size 
)
Parameters
[in]slotSlot 0: Built-in IO Ports, Slots 1 ~ 9: Expansion IO Ports.
[in]channel_triggerA bitwise value to specify that the channel to be trigger. If bit 0's value is 1, then channel 0 will be triggered, and so on.
[in]fore_intervalThe pre-recording time before the trigger time (one unit = 1 second).
[in]back_intervalThe recording time after the trigger time (one unit = 1 second).
[out]required_buf_sizeThe required buffer size of the batch of AI raw data.
Returns
MODULE_RW_ERR_CODE