Breadcrumbs

get_analog_input()

Definition

get_analog_input(ch)

Features

This function reads the channel value corresponding to the controller analog input.

Parameters

Parameter Name

Data Type

Default Value

Description

ch

int

-

  • 1 : channel 1

  • 2 : channel 2

Return

Value

Description

float

The analog input value of the specified channel

  • Current mode: 4.0~20.0 [mA]

  • Voltage mode: 0~10.0 [V]

Exception

Exception

Description

DR_Error (DR_ERROR_TYPE)

Parameter data type error occurred

DR_Error (DR_ERROR_VALUE)

Parameter value is invalid

DR_Error (DR_ERROR_RUNTIME)

C extension module error occurred

DR_Error (DR_ERROR_STOP)

Program terminated forcefully

Example

Python
set_mode_analog_input(ch=1, mod=DR_ANALOG_CURRENT)  #input ch1=current mode
set_mode_analog_input(ch=2, mod=DR_ANALOG_VOLTAGE)  #input ch2=voltage mode

Cur = get_analog_input(1)  # Reads the analog input current value of channel 1
Vol = get_analog_input(2)  # Reads the analog input voltage value of channel 2