I have around 60-70 inverters that I want to talk to using arduino over RS-485. The connection that I am making with arduino is according to the attached image.
The modbus library that I am using is SimpleModbus Library here's the link to it: https://drive.google.com/folderview?id=0B0B286tJkafVSENVcU1RQVBfSzg&usp=drive_web
The data format that the inverter manufacturer is using is as follows: start byte, slave address, function code, data, check, end byte.
Whereas the request I am sending through my master device looks something like this:
packet1->id = 25; packet1->function = READ_HOLDING_REGISTERS; packet1->address = 3000; packet1->no_of_registers = 3; packet1->register_array = regs;
I am not including any start byte or end byte. Is it the reason why I am not able to receive any response from the slave device? or is it because I have to program the response of the slave devices as well?
As of now I am only playing around with the master device code and have not figured out on how to receive the response of the slave and how to decode it. Every modubs library seems to have two kinds of program one for the master and other for the slave. Whereas I use only the master code for sending requests to the slaves.
Do I have to program for slaves as well? if yes then how to program for both the master and slaves together on my master device arduino which is talking to my inverters?
I am new to arduino but experienced in programming. Just lack some basics in electronics and modubs protorcol over RS-485. Kindly please help me
Thanks in advance.
P.S: I have wired all my inverters through RS_485 ports correctly, I am connecting the negative end to the pin 7 on RS-485 chip and the positive wire to the pin 6 on the chip