-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple Slaves? #2
Comments
The CSE_ModbusRTU library supports multiple Servers and Clients running on a single device. You can create as many objects as you want. Just make sure to use unique addresses (and names optionally) to identify them on the bus. |
Ok great, Thank you! Last question, it appears this library uses std::vector, which Arduino AVR's standard library doesn't (and can't) include, is there anyway around this? I'm using an Arduino Mega for its multiple Serial ports. |
I think I overlooked that side of the library. Since Modbus data sizes will be fixed and only set during the instantiation, we can use fixed memory allocation for them. I will soon add a workaround for the problem. |
Hi Vishnu. First of all a would like to appreciate your effort to create this library. I have started to implement it to Mega 2560. I have been facing an issue with std::vector. Finally I have found an solution for that and I put this line to code #include <ArduinoSTL.h>. This library is a port of uClibc++ Arduino library. Also I have some issue to compile code with SoftwareSerial. Finally I have commented out all SoftwareSerial lines in CSE_485.h, nevertheless I am using hardware ports only. My project is about to control heat recovery ventilation unit in house. I am able to read som input registers now (ADU, CRC, send, receive on serial monitor is correct). I am trying to use class CSE_ModbusRTU_ADU. I have defined CSE_ModbusRTU_ADU adu; and than in setup() CSE_ModbusRTU_ADU(); and in the loop () I put this line: unsigned int aduwrd = adu.getLength(); or getByte ..... but I get always 0x00 even though on serial monitor all ADU data is present and correct. Is it possible to explain how to use this in some sample code? Thank you. Mega 2560 board is client and ventilation unit is server. |
Hi @PedroPiko. Thanks for sharing the workaround for using |
All the examples and explainations are for a single master and slave. Do I need to make multiple Client objects?
The text was updated successfully, but these errors were encountered: