Breadcrumbs

get_analog_input()

정의

get_analog_input(ch)

기능

컨트롤러 아날로그 입력에 해당하는 채널의 값을 불러옵니다.

인수

인수명

자료형

기본값

설명

ch

int

-

  • 1 : channel 1

  • 2 : channel 2

리턴

설명

float

해당 channel의 analog input 값

  • 전류 모드인 경우: 4.0~20.0 [mA]

  • 전압 모드인 경우: 0~10.0 [V]

예외

예외

설명

DR_Error (DR_ERROR_TYPE)

인수들의 데이터형 오류 시

DR_Error (DR_ERROR_VALUE)

인수의 값이 유효하지 않을 시

DR_Error (DR_ERROR_RUNTIME)

C Extension 모듈 에러 발생 시

DR_Error (DR_ERROR_STOP)

프로그램 강제 종료 시

예제

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) # channel 1의 analog input 전류 값 읽기
Vol = get_analog_input(2) # channel 2의 analog input 전압 값 읽기