Direct connection to plc!!
-
Hi!
I've alredy implement the TCP master and slave clases but now i want to conect to a PLC an get data from it. So this is not my area, i'm just a saftware developer, but i was wondering: Do I just need to implement a Master tcp object and point it to the plc's ip address and do the request??
Any comments acepted. :?: :?: :?: :?: :?: :?: -
That's pretty much it, yeah.
-
Thanks, just another cuestion: the Slave object that i create for test works like a simulator of a plc??
-
I guess you could say that. It would be more accurate though to say that it works like a Modbus slave.
-
Hi! again. i have a question: how do i point the TCPMaster to the ip address of the PLC? because with the tcpslave class i asign a SlaveId and with this i was making the request. But now is directly to the PLC....
-
When you create the TCP master you have to provide an IpParameters instance. The host value is the IP of your slave.
-
ok, but when i send the request i pass the Slave id parameter, what about it??
-
See the s/getValue methods in ModbusMaster. You can provide the slave id directly or use a ModbusLocator to encapsulate register details.