import os from pymodbus.client.sync import ModbusSerialClient as ModbusClient #---------------------------------------------------------------------------# import logging logging.basicConfig() log = logging.getLogger() log.setLevel(logging.DEBUG) #---------------------------------------------------------------------------# client = ModbusClient(method='rtu', port='/dev/ttyUSB0', timeout=1, stopbits = 1, bytesize = 8, parity='N', baudrate= 9600) client.connect() os.system('clear') request = client.read_input_registers(0x0,0x1E,unit=1) print request.registers print "V1 :", request.registers[0], request.registers[1] print "A1 :", request.registers[2], request.registers[3] print "KW1 :", request.registers[4], request.registers[5] print "Kvar1 :", request.registers[6], request.registers[7] print "PF1 :", request.registers[8], request.registers[9] print "" print "V2 :", request.registers[10], request.registers[11] print "A2 :", request.registers[12], request.registers[13] print "KW2 :", request.registers[14], request.registers[15] print "Kvar2 :", request.registers[16], request.registers[17] print "PF2 :", request.registers[18], request.registers[19] print "" print "V3 :", request.registers[20], request.registers[21] print "A3 :", request.registers[22], request.registers[23] print "KW3 :", request.registers[24], request.registers[25] print "Kvar3 :", request.registers[26], request.registers[27] print "PF3 :", request.registers[28], request.registers[29]
Generated by GNU Enscript 1.6.5.90.
No hay comentarios:
Publicar un comentario