| ioPAC RTU Controllers C/C++ Sample Code Programming Guide

- Main Page
- Modules
- Data Structures
- Files

Modules | Functions
AI
Library » IO

## 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] | range | AI range
  [in] | bitsResolution | The resolution of a n-bit.
  [in] | rawValue | The raw value to transform.
  [out] | engValue | The 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] | range | AI range
  [in] | bitsResolution | The resolution of a n-bit.
  [in] | engValue | The engineering value to transform.
  [out] | rawValue | The 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] | range | AI range
  [in] | bitsResolution | The resolution of a n-bit.
  [in] | rawValue | The raw value to transform.
  [out] | engValue | The 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] | range | AI range
  [in] | bitsResolution | The resolution of a n-bit.
  [in] | engValue | The engineering value to transform.
  [out] | rawValue | The 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] | rawValue | The raw value to transform.
  [out] | engValue | The engineering value transformed form the input raw value.

void MX_RTU_AI_Raw_to_Eng_4_20mA | ( | int | rawValue,
|  | float * | engValue
| ) |  |

Parameters

  [in] | rawValue | The raw value to transform.
  [out] | engValue | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The AI raw data for the corresponding channels.
  [out] | time | Timestamp 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The AI engineering data for the corresponding channels.
  [out] | time | Timestamp 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to get.
  [in] | count | The number of channels to get.
  [out] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to set.
  [in] | count | The number of channels to set.
  [in] | buf | The 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | channel | Reset 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | channel | Reset 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | channel | Reset 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | channel | Reset 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] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | The first channel to set.
  [in] | count | The number of channels to set.
  [in] | buf | The burnout value for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

Note
  These values are valid only when the AI range is 4-20mA