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

- Main Page
- Modules
- Data Structures
- Files

Macros | Functions
AIEvent
Library » IOEvent

## Macros
#define | AI_TC_RTD_EVENT_GREATER 0
#define | AI_TC_RTD_EVENT_SMALLER 1
#define | AI_TC_RTD_EVENT_EQUAL 2

## Functions
IO_ERR_CODE | MX_RTU_AI_Event_Register (UINT8 slot, UINT8 channel, float value, UINT32 condition, int *handle)
IO_ERR_CODE | MX_RTU_AI_Event_Unregister (int handle)
IO_ERR_CODE | MX_RTU_AI_Event_Get (int handle, float *value, struct Timestamp *time)
IO_ERR_CODE | MX_RTU_AI_Event_Set_Value (int handle, float value, UINT32 condition)
IO_ERR_CODE | MX_RTU_AI_Event_Get_Value (int handle, float *value, UINT32 *condition)
IO_ERR_CODE | MX_RTU_AI_Event_Count (int handle, UINT32 *count)
IO_ERR_CODE | MX_RTU_AI_Event_Clear (int handle)
IO_ERR_CODE | MX_RTU_AI_Event_Reset (void)

## Detailed Description

Sample Code:
ai_event.c

## Macro Definition Documentation

#define AI_TC_RTD_EVENT_GREATER 0

#define AI_TC_RTD_EVENT_SMALLER 1

#define AI_TC_RTD_EVENT_EQUAL 2

## Function Documentation

IO_ERR_CODE MX_RTU_AI_Event_Register | ( | UINT8 | slot,
|  | UINT8 | channel,
|  | float | value,
|  | UINT32 | condition,
|  | int * | handle
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO, slot 1 ~ 12: IO Module.
  [in] | channel | channel 0 ~ 23.
  [in] | value | An AI value works with the AI Condition.
  [in] | condition | Condition should be AI_TC_RTD_EVENT_GREATER , AI_TC_RTD_EVENT_SMALLER , or AI_TC_RTD_EVENT_EQUAL .
  [out] | handle | A handle, like a file descriptor, stands for the AI Event.

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_AI_Event_Unregister | ( | int | handle | ) |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_AI_Event_Get | ( | int | handle,
|  | float * | value,
|  | struct Timestamp * | time
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.
  [out] | value | An AI value when the condition and value are matched.
  [out] | time | Timestamp of the AI Event.

Returns
  IO_ERR_CODE

Note
  Maximum I/O Events are IO_EVENT_QUEUE_MAX .

IO_ERR_CODE MX_RTU_AI_Event_Set_Value | ( | int | handle,
|  | float | value,
|  | UINT32 | condition
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.
  [in] | value | An AI value works with the AI Condition.
  [in] | condition | Condition should be AI_TC_RTD_EVENT_GREATER , AI_TC_RTD_EVENT_SMALLER , or AI_TC_RTD_EVENT_EQUAL .

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_AI_Event_Get_Value | ( | int | handle,
|  | float * | value,
|  | UINT32 * | condition
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.
  [out] | value | An AI value when the condition and value are matched.
  [out] | condition | Condition can be AI_TC_RTD_EVENT_GREATER , AI_TC_RTD_EVENT_SMALLER , or AI_TC_RTD_EVENT_EQUAL .

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_AI_Event_Count | ( | int | handle,
|  | UINT32 * | count
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.
  [out] | count | The amount of AI Events in I/O Event Queue.

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_AI_Event_Clear | ( | int | handle | ) |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the AI Event.

Returns
  IO_ERR_CODE

Note
  Clear all AI Events in queue.

IO_ERR_CODE MX_RTU_AI_Event_Reset | ( | void |  | ) |

Returns
  IO_ERR_CODE

Note
  Unregister all registered AI Events.