tarm / serial

BSD 3-Clause "New" or "Revised" License
1.62k stars 452 forks source link

Serial only receive 1 byte #84

Open andarm opened 6 years ago

andarm commented 6 years ago

run on window

xiegeo commented 6 years ago

You need to put read in a loop. Use the third byte to calculate total length.

If you need something that also takes timing into consideration and handles more opcodes, you can check out my code here https://github.com/xiegeo/modbusone/blob/master/packet_reader.go

andarm commented 6 years ago

Thanks ,I got it.