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

- Main Page
- Modules
- Data Structures
- Files

Functions
DIO
Library » IO

## Functions
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_Map_Get (UINT8 slot, UINT32 *map)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_Map_Set (UINT8 slot, UINT32 map)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Value_Get (UINT8 slot, UINT32 *value, struct Timestamp *time)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Mode_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Filter_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Start_Get (UINT8 slot, UINT32 *start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Trigger_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Value_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf, struct Timestamp *time)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Overflow_Get (UINT8 slot, UINT32 *overflow)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Frequency_Start_Get (UINT8 slot, UINT32 *start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Frequency_Measurement_Time_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Frequency_Get (UINT8 slot, UINT8 start, UINT8 count, float *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Mode_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Filter_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Start_Set (UINT8 slot, UINT32 start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Trigger_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Value_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Counter_Overflow_Reset (UINT8 slot, UINT32 overflow)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Frequency_Start_Set (UINT8 slot, UINT32 start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DI_Frequency_Measurement_Time_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_Value_Get (UINT8 slot, UINT32 *value)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_Mode_Get (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_SigW_L_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_SigW_H_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Start_Get (UINT8 slot, UINT32 *start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Count_Get (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Config_Get (UINT8 slot, UINT8 start, UINT8 count, float *frequency, float *dutyCycle)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_Value_Set (UINT8 slot, UINT32 value)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_Mode_Set (UINT8 slot, UINT8 start, UINT8 count, UINT8 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_SigW_L_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_SigW_H_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Start_Set (UINT8 slot, UINT32 start)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Stop_Set (UINT8 slot, UINT32 stop)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Count_Set (UINT8 slot, UINT8 start, UINT8 count, UINT32 *buf)
MODULE_RW_ERR_CODE | MX_RTU_Module_DIO_DO_PWM_Config_Set (UINT8 slot, UINT8 start, UINT8 count, float *frequency, float *dutyCycle)

## Detailed Description

Sample Code:
dio.c

## Function Documentation

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_Map_Get | ( | UINT8 | slot,
|  | UINT32 * | map
| ) |  |

This function get the direction info of all DIO channels

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | map | A bitwise value to indicate all DIO channels' direction. 1:DO, 0:DI

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_Map_Set | ( | UINT8 | slot,
|  | UINT32 | map
| ) |  |

This function set the direction info of all DIO channels

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | map | A bitwise value to indicate all DIO channels' direction. 1:DO, 0:DI

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Value_Get | ( | UINT8 | slot,
|  | UINT32 * | value,
|  | struct Timestamp * | time
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | value | A bitwise value to indicate all channels' values. The bit 0 represents channel 0's value and so on.
  [out] | time | Timestamp of DI value.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Mode_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 DI modes for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Filter_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 DI filter values for the corresponding channels. ioPAC 8500/8600: One unit = 100us. ioPAC 5542: One unit = 500us. ioPAC 5542-HSPA: One unit = 500us.

Returns
  MODULE_RW_ERR_CODE

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

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | start | A bitwise value to indicate all channels counters' status. The bit 0's value represents channel 0's counter is started or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_Trigger_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 DI counter trigger conditions for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_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 counter values for the corresponding channels.
  [out] | time | The Timestamp of di counter values.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_Overflow_Get | ( | UINT8 | slot,
|  | UINT32 * | overflow
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | overflow | A bitwise value to indicate all channels' overflow status. The bit 0's value represents channel 0's counter is overflowed or not and so on (0: ok, 1: overflow).

Returns
  MODULE_RW_ERR_CODE

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

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | start | A bitwise value to indicate all channels counters' status. The bit 0's value represents channel 0's counter is started or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Frequency_Measurement_Time_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 measurement time for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Frequency_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 frequency for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Mode_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 DI modes for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Filter_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 DI filter values for the corresponding channels. ioPAC 8500/8600: One unit = 100us. ioPAC 5542: One unit = 500us. ioPAC 5542-HSPA: One unit = 500us.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_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 counters' status. The bit 0's value represents channel 0's counter will start or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_Trigger_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 DI counter trigger conditions for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_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.
  [in] | buf | The counter values for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Counter_Overflow_Reset | ( | UINT8 | slot,
|  | UINT32 | overflow
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | overflow | A bitwise value to specify that the channel's overflow flag to be reset. The bit 0's value is 1 represents channel 0's counter overflow flag will be reset and so on.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Frequency_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 counters' status. The bit 0's value represents channel 0's counter will start or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DI_Frequency_Measurement_Time_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 measurnment time for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_Value_Get | ( | UINT8 | slot,
|  | UINT32 * | value
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | value | A bitwise value to indicate all channels' values. The bit 0 represents channel 0's value and so on.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_Mode_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 DO modes for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_SigW_L_Get | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | UINT32 * | buf
| ) |  |

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_SigW_H_Get | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | UINT32 * | buf
| ) |  |

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

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [out] | start | A bitwise value to indicate all channels PWMs' status. The bit 0's value represents channel 0's PWM is started or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

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

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_PWM_Config_Get | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | float * | frequency,
|  | float * | dutyCycle
| ) |  |

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 DO PWM frequency (Hz) for the corresponding channels. Range = 0.01Hz ~ MAX supported freqency.
  [out] | dutyCycle | The DO PWM ON duty cycle (%) for the corresponding channels. Range = 0.1% ~ 99.9%.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_Value_Set | ( | UINT8 | slot,
|  | UINT32 | value
| ) |  |

Parameters

  [in] | slot | slot 0: Built-in IO Ports, slot 1 ~ 12: Expansion IO Ports.
  [in] | value | A bitwise value to indicate all channels' values. The bit 0 represents channel 0's value and so on.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_Mode_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 DO modes for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_SigW_L_Set | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | UINT32 * | buf
| ) |  |

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_SigW_H_Set | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | UINT32 * | buf
| ) |  |

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_PWM_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 PWMs' status. The bit 0's value represents channel 0's PWM will start or not and so on (0: stop, 1: start).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_PWM_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 PWMs' status. The bit 0's value represents channel 0's PWM will stop or not and so on (0: ignore, 1: stop).

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_PWM_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 PWM count for the corresponding channels.

Returns
  MODULE_RW_ERR_CODE

MODULE_RW_ERR_CODE MX_RTU_Module_DIO_DO_PWM_Config_Set | ( | UINT8 | slot,
|  | UINT8 | start,
|  | UINT8 | count,
|  | float * | frequency,
|  | float * | dutyCycle
| ) |  |

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 DO PWM frequency (Hz) for the corresponding channels. Range = 0.01Hz ~ MAX supported freqency.
  [in] | dutyCycle | The DO PWM ON duty cycle (%) for the corresponding channels. Range = 0.1% ~ 99.9%.

Returns
  MODULE_RW_ERR_CODE