I need to make some "simple" tool for collecting data from one of the controller. Communication is rs485 rtu. I tried to make reader with arduino nano and MAX485 module converter. Problem is that this task is not as simple as it seems...
I have no problems to connect two arduinos and send data between them - I have problems when Register address is like 7000, 8000 and communication with 485 is on SoftwareSerial on 19200 as I need to use Serial to communicate with PC (parsing data from 485 and send it to pc). My arduino is slave, always on address 7.
I guess that i need to know when write multiple registers function is called as there are messages about status of device..
Can you please point me to some good library or example that could do that? I will appreciate and take any help
I guess that means Modbus RTU. Can you acknowledge this?
My arduino is slave, always on address 7.
If the Arduino is slave which device is the master? Post a link to that device!
I have problems when Register address is like 7000, 8000 and communication with 485 is on SoftwareSerial on 19200 as I need to use Serial to communicate with PC (parsing data from 485 and send it to pc).
Why do you need the PC connection on a Modbus RTU slave device? Just for debugging?
with example provided
That probably won't work as it most probably don't match the expectation of your master device.
Please start be describing what exactly you're trying to achieve (not how you think you should achieve that). Should your Arduino emulate some other device? If so, please provide a link to that device that should be emulated.
Device that act as master is some custom device that I get.. it is not published anywhere. In every Modbus register is status of device relay for and i need to check if that is true - when i read from modbus that relay 3 should be open I have to check if that is true and sent over serial "relay 3 ok"..
Device that act as master is some custom device that I get.. it is not published anywhere. In every Modbus register is status of device relay for and i need to check if that is true - when i tead from modbus that relay 3 should be open I have to check if that is true and sent over serial "relay 3 ok"..
That doesn't sound as if your device will be a slave. The slave doesn't get the status from the master. It's the master who is asking the slaves for their states.
Master is writing status all the time..
To where? That's not how Modbus is working.
Post the documentation you have for your Modbus device. Without documentation you won't get that thing running.
pylon:
To where? That's not how Modbus is working.
I understand that this is not standard behaviour of master device but in this case it is made like this.. in first 10 seconds device is writing registers to slave device on specified address. that is made just for test - later on it is searching for other type of devices.
pylon:
Post the documentation you have for your Modbus device. Without documentation you won't get that thing running.
function definition pasted in first post is all I got.. I can also record rs485 requests- there you see that it is really writing to address 7000 in first 10 seconds and after that it start to search for other slaves.
My problem is that I cannot see requests from master on my arduino..
That example doesn't react on address 7000. It's made for typical slave setups where you can define the address layout. With that library you cannot set the address range, it provides all information at the first few addresses (0-x). Most slave Modbus libraries for the Arduino handles it the same way. I remember one that allowed to each address explicitly but I cannot find the link at the moment.
And somehow i need to send results to pc also.. any other idea?
If you need that connection to be reliable buy a Mega2560 which has 4 hardware serial interfaces.