So i'm working on a device to talk to my modbus enabled power-meter. I have used the search and have found lots of dead threads which basically more or less the same problems i faced until now. I found the "pycom" modbus library but i haven't found an answer to the question "wtf is pycom and how does it differ from micropython?" and therefore didn't test it. Then i found someone who attempted to port it to micropython which has the _uart.wait_tx_done(2) part which doesn't work, as already discussed in a different thread, so i patched that out and it does the same one character send as my 4 lines.
Screenshots from Com monitor: https://imgur.com/a/tjS4mSd
Code: Select all
from machine import Pin, UART uMB = UART(0, baudrate=9600, bits=8, parity=0, stop=1, timeout_char=10, tx=Pin(15), rx=Pin(13)) outp = bytearray(b'\x01\x03\x00\x09\x00\x02\x14\x09') uMB.write(outp)
Is this possible with the current uart implementation? if yes how?
The only obvious difference i see is the "datalength" which for micropython seems to be 1 and for modbus 8