We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Modbus extension
#3
In the case of the serial variant, some thoughts

In theory, it should work with SmallBasic. However, there are no examples yet with binary protocols over the serial interface.
An extension for the serial port is required. I recommend Litdev's LDCommPort (there are others as well).
I assume that the RXAll and TXAll functions don't work with binary strings. However, there are TXByte and RXByte for reading and writing bytes one after the other.
The challenge is generating and decoding the telegrams:
1.Byte:      Slave Address
2.Byte:      FunctionCode
3-n.Byte:   ByteCount & Data
n+1 Byte:  2-Byte CRC Checksum

The difficult part is generating the CRC checksum and converting the binary data into numeric values.

The SB program would be the master, and the PV system would be the slave.
It's also important to ensure that the complete transmission protocol is present before sending the individual bytes, since the Modbus specification requires that the timeout between the individual bytes also be checked.

So, all I can say is, letsrock
[-] The following 1 user Likes Scout's post:
  • stevantosic
Reply


Messages In This Thread
Modbus extension - by letsrock - 08-17-2025, 02:52 PM
RE: Modbus extension - by litdev - 08-17-2025, 04:53 PM
RE: Modbus extension - by Scout - 08-17-2025, 05:58 PM
RE: Modbus extension - by letsrock - 08-17-2025, 07:40 PM
RE: Modbus extension - by litdev - 08-17-2025, 09:17 PM
RE: Modbus extension - by litdev - 08-18-2025, 11:17 AM
RE: Modbus extension - by letsrock - 08-19-2025, 10:13 AM
RE: Modbus extension - by litdev - 08-19-2025, 07:36 PM
RE: Modbus extension - by Scout - 08-19-2025, 09:13 PM
RE: Modbus extension - by litdev - 08-19-2025, 09:36 PM
RE: Modbus extension - by letsrock - 08-22-2025, 10:04 AM
RE: Modbus extension - by AbsoluteBeginner - 08-22-2025, 02:46 PM
RE: Modbus extension - by litdev - 08-22-2025, 03:58 PM
RE: Modbus extension - by letsrock - 08-22-2025, 05:10 PM
RE: Modbus extension - by litdev - 08-22-2025, 07:58 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)