wellpro 3066 - 온도 데이타 읽어오기 > 시리얼 통신

본문 바로가기

회원로그인

회원가입

시리얼 통신

tcp wellpro 3066 - 온도 데이타 읽어오기

페이지 정보

profile_image
작성자 최고관리자
댓글 0건 조회 113회 작성일 22-11-23 13:23

본문

import sys, time
from pyModbusTCP.client import ModbusClient


while True:
    '''
    # 3066 읽어오기
    모듈의 온도 입력 데이터를 읽는 명령어입니다.
    데이터는 16진수 데이터로 10진수 데이터로 변환해야 하는 데이터이므로 공식에 대입하여 계산합니다.
    A、If data = 65535, the temperature sensor is not connected
    B、If data > 10000 and data < 65535, the temperature is below 0℃
            TEMP = -(DATA-10000)/10
    C、if data < 10000, the temperature is over 0℃
            TEMP = DATA/10
    '''
    modbus_client = ModbusClient("172.30.1.109", 8899, unit_id=2)
    #print(modbus_client)
   
    r = modbus_client.read_holding_registers(0, 8)
    print("r => ", r)
    #print("r=>", r[0])

댓글목록

등록된 댓글이 없습니다.