I’m building now a small MikroC program that reads (via I²C bus) data from an accelerometer --- this part is OK, works fine---, and I want to complete my program by allowing a PLC programmer to read those accelerometer data via Modbus RS-485.
My data (from accelero.) array is 7-bytes long, so I know I cannot use the standard MikroC RS-485 library.
**Would you have an example of MikroC code (or even MikroBasic) that could help me in this small application?
I suppose we have to build our array according to the Modbus protocol, but at this point, I’m quite confused (w/ CRC frame, etc.). Feel free for any help,
NOTA: I' using a Pic18F258. I already have a MAX485 driver. I certainly need to set a 485 address to this MCU, and by this address, I want the PLC user get access to the 7 data (ex: X-axis value, Y-axis-Value, Status byte …).