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

- Main Page
- Modules
- Data Structures
- Files

Macros | Functions
DIEvent
Library » IOEvent

## Macros
#define | DI_EVENT_TOGGLE_L2H 0
#define | DI_EVENT_TOGGLE_H2L 1
#define | DI_EVENT_TOGGLE_BOTH 2

## Functions
IO_ERR_CODE | MX_RTU_DI_Event_Register (UINT8 slot, UINT8 channel, UINT32 trigger, int *handle)
IO_ERR_CODE | MX_RTU_DI_Event_Unregister (int handle)
IO_ERR_CODE | MX_RTU_DI_Event_Get (int handle, UINT32 *status, struct Timestamp *time)
IO_ERR_CODE | MX_RTU_DI_Event_Set_Trigger (int handle, UINT32 trigger)
IO_ERR_CODE | MX_RTU_DI_Event_Get_Trigger (int handle, UINT32 *trigger)
IO_ERR_CODE | MX_RTU_DI_Event_Count (int handle, UINT32 *count)
IO_ERR_CODE | MX_RTU_DI_Event_Clear (int handle)
IO_ERR_CODE | MX_RTU_DI_Event_Reset ()

## Detailed Description

Sample Code:
di_event.c

## Macro Definition Documentation

#define DI_EVENT_TOGGLE_L2H 0

#define DI_EVENT_TOGGLE_H2L 1

#define DI_EVENT_TOGGLE_BOTH 2

## Function Documentation

IO_ERR_CODE MX_RTU_DI_Event_Register | ( | UINT8 | slot,
|  | UINT8 | channel,
|  | UINT32 | trigger,
|  | int * | handle
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO, slot 1 ~ 12: IO Module.
  [in] | channel | channel 0 ~ 23.
  [in] | trigger | Trigger should be DI_EVENT_TOGGLE_L2H , DI_EVENT_TOGGLE_H2L , or DI_EVENT_TOGGLE_BOTH .
  [out] | handle | A handle, like a file descriptor, stands for the DI Event.

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_DI_Event_Unregister | ( | int | handle | ) |

Parameters

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

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_DI_Event_Get | ( | int | handle,
|  | UINT32 * | status,
|  | struct Timestamp * | time
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the DI Event.
  [out] | status | A DI status when the trigger is matched.
  [out] | time | Timestamp of the DI Event.

Returns
  IO_ERR_CODE

Note
  Maximum I/O Events are IO_EVENT_QUEUE_MAX .

IO_ERR_CODE MX_RTU_DI_Event_Set_Trigger | ( | int | handle,
|  | UINT32 | trigger
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the DI Event.
  [in] | trigger | Trigger should be DI_EVENT_TOGGLE_L2H , DI_EVENT_TOGGLE_H2L , or DI_EVENT_TOGGLE_BOTH .

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_DI_Event_Get_Trigger | ( | int | handle,
|  | UINT32 * | trigger
| ) |  |

Parameters

  [in] | handle | A handle, like a file descriptor, stands for the DI Event.
  [out] | trigger | Trigger can be DI_EVENT_TOGGLE_L2H , DI_EVENT_TOGGLE_H2L , or DI_EVENT_TOGGLE_BOTH .

Returns
  IO_ERR_CODE

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

Parameters

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

Returns
  IO_ERR_CODE

IO_ERR_CODE MX_RTU_DI_Event_Clear | ( | int | handle | ) |

Parameters

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

Returns
  IO_ERR_CODE

Note
  Clear all DI Events in queue.

IO_ERR_CODE MX_RTU_DI_Event_Reset | ( |  | ) |

Returns
  IO_ERR_CODE

Note
  Unregister all registered DI Events.