08-17-2025, 05:58 PM
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
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