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

- Main Page
- Modules
- Data Structures
- Files

Modules | Functions
AO
Library » IO

## Modules
| AO_RANGE
| AO_STATUS
| AO_WAVEFORM_TYPE

## Functions
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Enable_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Range_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Raw_Value_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Eng_Value_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Status_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Type_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Config_Get (UINT8 slot, UINT8 start, UINT8 count, float *frequency, float *amplitude, float *offset)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Count_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Start_Get (UINT8 slot, UINT32 *start)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Enable_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Range_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Raw_Value_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Eng_Value_Set (UINT8 slot, UINT8 start, UINT8 count, float *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Type_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Config_Set (UINT8 slot, UINT8 start, UINT8 count, float *frequency, float *amplitude, float *offset)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Count_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Start_Set (UINT8 slot, UINT32 start)
MODULE_RW_ERR_CODE | MX_RTU_Module_AO_Waveform_Stop_Set (UINT8 slot, UINT32 stop)

## Detailed Description

Sample Code:
ao.c

## Function Documentation

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Enable_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 enable status for the corresponding channels. 0: disable, 1: enable.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_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 AO range for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Raw_Value_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 AO raw data for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Eng_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 AO engineering data for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_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 AO status for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Type_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 set.
  [in] | count | The number of channels to set.
  [out] | buf | The waveform type for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Config_Get | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | float * | frequency,
|  | float * | amplitude,
|  | float * | offset
| ) |  |

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] | frequency | The waveform frequency (Hz) for the corresponding channels. Range = 0.01Hz ~ MAX supported freqency.
  [out] | amplitude | The waveform amplitude (engineering value) for the corresponding channels.
  [out] | offset | The waveform offset (engineering value) for the corresponding channels. Range = -10V ~ 10V.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Count_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 set.
  [in] | count | The number of channels to set.
  [out] | buf | The numbers of waveform count for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Start_Get | ( | UINT8 | slot,
|  | UINT32 * | start
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Enable_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 enable status for the corresponding channels. 0: disable, 1: enable.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_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 AO range for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Raw_Value_Set | ( | 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 set.
  [in] | count | The number of channels to set.
  [out] | buf | The output value for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

Note
  The resolution of 86M-4420 is 12 bits. The corresponding values of each range show as follow:
  AO_RANGE_10V:

  0x800 | 0xC00 | 0x000 | 0x3FF | 0x7FF
  --- | --- | --- | --- | ---
  -10V | -5V | 0V | 5V | 10V

  AO_RANGE_0_10V:

  0x000 | 0x3FF | 0x7FF | 0xBFF | 0xFFF
  --- | --- | --- | --- | ---
  0V | 2.5V | 5V | 7.5V | 10V

  AO_RANGE_0_20mA:

  0x000 | 0x3FF | 0x7FF | 0xBFF | 0xFFF
  --- | --- | --- | --- | ---
  0mA | 5mA | 10mA | 15mA | 20mA

  AO_RANGE_4_20mA:

  0x000 | 0x3FF | 0x7FF | 0xBFF | 0xFFF
  --- | --- | --- | --- | ---
  4mA | 8mA | 12mA | 16mA | 20mA

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Eng_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.
  [out] | buf | The output value for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Type_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 waveform type for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

Note
  The AO waveform is avaliable only when the range is AO_RANGE_10V or AO_RANGE_0_10V .

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Config_Set | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | float * | frequency,
|  | float * | amplitude,
|  | float * | offset
| ) |  |

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.
  [in] | frequency | The waveform frequency (Hz) for the corresponding channels. Range = 0.01Hz ~ MAX supported freqency.
  [in] | amplitude | The waveform amplitude (engineering value) for the corresponding channels.
  [in] | offset | The waveform offset (engineering value) for the corresponding channels. Range = -10V ~ 10V.

Returns
  MODULE_RW_ERR_CODE

Note
  The default value of the offset is 0.

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Count_Set | ( | 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 set.
  [in] | count | The number of channels to set.
  [in] | buf | The numbers of waveform count for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Start_Set | ( | UINT8 | slot,
|  | UINT32 | start
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | start | A bitwise value to indicate all channels waveforms' status. The bit 0's value represents channel 0's waveform will start or ignore and so on (0: ignore, 1: start).

Returns
  MODULE_RW_ERR_CODE

Note
  The AO waveform is avaliable only when the range is AO_RANGE_10V or AO_RANGE_0_10V .

MODULE_RW_ERR_CODE MX_RTU_Module_AO_Waveform_Stop_Set | ( | UINT8 | slot,
|  | UINT32 | stop
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | stop | A bitwise value to indicate all channels waveforms' status. The bit 0's value represents channel 0's waveform will stop or ignore and so on (0: ignore, 1: stop).

Returns
  MODULE_RW_ERR_CODE