Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing PLCs in Java  RSS feed

 
Senthil Kumar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Could anyone help me in guiiding me to access PLCs from Java?
ie., Accessing registers,timers etc available in the PLCs.

There may be many PLCs from different vendors.Does the coding differs with Vendors ie., is it Vendor specific?


Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without more information it's impossible to help. How are you trying to connect to the PLC? Are you trying to program the PLC directly, or communicate with it over... something?
 
Senthil Kumar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually i want a java application(Client) to
(i) connect to PLC
(ii) read the registers
(iii) Perform some operation with the data available in the registers.

Please let me know in case any additional details required.

Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you'd need to describe how you're connecting to the PLC. Then you'd need to use the PLC's documentation to communicate to it in a way the PLC understands. Unless there's an industry-wide specification that defines a PLC communication framework this will be PLC- or manufacturer-specific.
 
Senthil Kumar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all Thanks Newton for your response....
Here are the details.

(i) I would connect to the PLC through RS-232.
(ii)if am not wrong,then application thats gonna be devloped is only specific to a vendor.
Am not clear in the way i need to communicate.So could you please explain it in a much more elaborated manner.

Thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, so you need to know the protocol for talking to the PLC--serial communications in Java is the easy part.
 
Senthil Kumar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok.If i understand correctly, i should make use of serial communications to talk to any PLC.
Please confirm the same.

So,could you please let me know the other possible ways that i can communicate to PLCs(which might be the hardest part.Just eager to know that).

Thanks.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Senthil Kumar wrote:Ok.If i understand correctly, i should make use of serial communications to talk to any PLC.
Please confirm the same.

That's what *you* said--I have no idea how the PLC, or PLCs, you want to talk to communicate with other machines.
So,could you please let me know the other possible ways that i can communicate to PLCs(which might be the hardest part.Just eager to know that).

Networking, RS-422, I2C, CAN, I have no idea how many ways there are to talk to a PLC.
 
C Gamache
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Senthil Kumar wrote:Ok.If i understand correctly, i should make use of serial communications to talk to any PLC.
Please confirm the same.

So,could you please let me know the other possible ways that i can communicate to PLCs(which might be the hardest part.Just eager to know that).

Thanks.


If the PLC has an RS-232 interface (say, a DB9 socket) you would attach it to your computer's serial port. If it behaves like a regular serial device you can use a library like RX-TX (http://rxtx.qbang.org/wiki/index.php/Main_Page) which provides interface hooks for communicating with serial devices. You'll need your PLC's technical manual, and then you'll have to figure out how to poke it in the right spot to make it do what you want it to do. If it doesn't behave like a regular serial device, you at least have RX-TX to modify to make it do what you need it to do. IIRC, RX-TX uses JNI to access your hardware, so if you get really far off the beaten trail you might have to modify those native libraries also.

HTH,

CG
 
Senthil Kumar
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Gamache.
With the examples available in the url,i was able to get an idea.
Is there a separate way to acces the registers etc which are available in the PLCs?

My assumption is, after establishing a connection to the PLC.

(i) we have to browse for the registers.
(ii)access the registers for data
....

Am i in the right path?
Please share your thoughts on the same.

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!