Code: Select all
stty -F /dev/ttyUSB0Code: Select all
sudo stty -F /dev/ttyUSB0 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0When did you last update the kernel? It should be 4.4.38 or so for armv7lpromod wrote:uname -a shows this :
Linux vyvoj 4.1.19-v7+ #858 SMP Tue Mar 15 15:56:00 GMT 2016 armv7l GNU/Linux
Code: Select all
[288977.314445] usb 1-1.2: new full-speed USB device number 14 using dwc_otg
[288977.417589] usb 1-1.2: New USB device found, idVendor=1a86, idProduct=7523
[288977.417603] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[288977.417610] usb 1-1.2: Product: USB2.0-Serial
[288977.418770] ch341 1-1.2:1.0: ch341-uart converter detected
[288977.422592] usb 1-1.2: ch341-uart converter now attached to ttyUSB0
[289033.671903] w1_master_driver w1_bus_master1: Family 0 for 00.72e800000000.47 is not registered.
pi@raspberrypi:~ $ lsusb
Bus 001 Device 004: ID 0bc2:3312 Seagate RSS LLC
Bus 001 Device 014: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $Code: Select all
pi@raspberrypi:~ $ sudo stty -F /dev/ttyUSB0
speed 9600 baud; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; start = <undef>; stop = <undef>; susp = <undef>; rprnt = <undef>;
werase = <undef>; lnext = <undef>; flush = <undef>; min = 0; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echokeCode: Select all
import minimalmodbus
mb = minimalmodbus
mb.BAUDRATE = 9600
mb.PARITY = 'O'
mb.BYTESIZE = 8
mb.STOPBITS = 1
mb.TIMEOUT = 1.0
DirisA10 = mb.Instrument(port='/dev/ttyUSB0', slaveaddress=1, mode='rtu')
DirisA10.debug = True
Address = 50520
Sub_Address = 40000
print DirisA10.read_register(registeraddress=2822,numberOfDecimals=2, functioncode=3, signed=False)Code: Select all
MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x0b\x06\x00\x01f/' (01 03 0B 06 00 01 66 2F)
MinimalModbus debug mode. No sleep required before write. Time since previous read: 1490820559858.6 ms, minimum silent period: 4.01 ms.
MinimalModbus debug mode. Response from instrument: '' () (0 bytes), roundtrip time: 1001.2 ms. Timeout setting: 1000.0 ms.Code: Select all
C:\Python27>python.exe serial.txt
MinimalModbus debug mode. Writing to instrument (expecting 7 bytes back): '\x01\x03\x0b\x06\x00\x01f/' (01 03 0B 06 00 01 66 2F)
MinimalModbus debug mode. No sleep required before write. Time since previous read: 1490819882205.0 ms, minimum silent period: 4.01 ms.
MinimalModbus debug mode. Response from instrument: '\x01\x03\x02Q\xddE\x8d' (01 03 02 51 DD 45 8D) (7 bytes), roundtrip time: 46.0 ms. Timeout setting: 1000.0ms.
209.57Code: Select all
mb.BAUDRATE = 19200
mb.PARITY = 'N'
mb.BYTESIZE = 8
mb.STOPBITS = 1
mb.TIMEOUT = 1.0
dirisa10 = mb.Instrument(port='/dev/ttyUSB0', slaveaddress=1, mode='rtu')