1
\$\begingroup\$

I have a Click PLC which has two RJ12 ports. I have successfully programmed it using C# and nModBus as a slave, but now I want to test the PLC as a master and the PC as a slave and noticed my laptop has a female RJ12 port, and was thinking is there a way I could transmit data across RJ12 to my PC from the PLC (e.g. PLC as master telling PC slave to read some data). Is this possible, and if so, where do I begin to communicate through RJ12?

If it's not possible, then here's this. If I use two adapters, one to convert RJ12 to Serial DB9 and another from DB9 to USB to connect to my computer, should I be able to communicate through the serial port on my laptop, or will two adapters cause some conflictions?

Thanks in advance stack!

\$\endgroup\$
  • \$\begingroup\$ The female RJ12 port on your laptop is probably a modem. Does their documentation show the pinouts for the RJ12 port or give any hints at the protocol? \$\endgroup\$ – PeterJ Aug 1 '14 at 5:44
  • \$\begingroup\$ No, and you are right in device manager it says there is a modem, so that is what I was thinking as well.. \$\endgroup\$ – Pardon_me Aug 1 '14 at 5:52
  • \$\begingroup\$ There is a post (#4) on a PLC forum where people use the usb to serial approach: forums.mrplc.com/index.php?showtopic=21034 \$\endgroup\$ – Enemy Of the State Machine Aug 1 '14 at 6:53
  • \$\begingroup\$ Did you actually program the Click PLC with C#, or did you write a C# program for your PC that you want to use to communicate with the Click PLC? \$\endgroup\$ – Ben Miller - Reinstate Monica Aug 1 '14 at 17:13
  • \$\begingroup\$ Well I wrote a program using the nModBus library, and yes it successfully communicates to the PLC. \$\endgroup\$ – Pardon_me Aug 1 '14 at 17:21
2
\$\begingroup\$

The 6P6C (RJ12) ports on the Click PLC are RS-232 serial ports. The 6P6C port on your laptop is a modem, which connects to a telephone line. Therefore, you will not be able to use the 6P6C port on your laptop to connect to the Click's serial ports.

Yes, you can connect your PC to the Click. The protocols used by the Click PLC's Port 2 are either ModBus (Master or Slave) or ASCII. Documentation on the serial ports can be found in Chapter 4 of the manual (pdf). You can either purchase an adapter cable to convert to DE-9 (sometimes called DB-9) from AutomationDirect (D2-DSCBL) or build your own. (The pinout for the cable is on page 2 of this pdf; the cable is D2-DSCBL.) Since it sounds like you don't have a DE-9 serial port on your computer, you should be able to then hook this cable up to a USB-Serial adapter. However, if you don't have any experience using USB-Serial adapters, you should know that it is sometimes tricky to get these things working correctly with the drivers.

Alternatively, AutomationDirect sells a USB cable/module (EA-MG-PGM-CBL) specifically for their PLCs. This is essentially a USB-Serial adapter, but the driver has been tested to work with their PLCs, and the adapter goes directly to their 6P6C (RJ12) pinout (it avoids the DE-9 step).

\$\endgroup\$
0
\$\begingroup\$

Did you actually program the Click PLC with C#, or did you write a C# program for your PC that you want to use to communicate with the Click PLC? – Ben Miller Aug 1 '14 at 17:13

Well I wrote a program using the nModBus library, and yes it successfully communicates to the PLC. – Pardon_me Aug 1 '14 at 17:21

I think your solution is in your comment.

  • Use your PC software to continuously poll the PLC for status change. You can make this very fast by just polling one location continuously and have the PLC change that location value when it needs to be read.
  • On detecting a status change the PC can then do a full read (which may take some time).
  • On completing the read the PC can reset the PLC status back to zero so that the PLC knows data read is complete.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.