Author Topic: PLC-PLC Communication  (Read 11951 times)

Pneuman

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
PLC-PLC Communication
« on: September 30, 2006, 02:41:04 PM »
I need help. I Have two T100MD series PLC hooked together RS485 connections. I ran the sample program: Remote IO series M, and the PLC talk to each other, so I know that works.

I have tried to adapt the program to read the A/D channels from the Slave PLC and can't make it work. As an alternative I also tried to transfer the interger variables representing the A/d channels to the Master PLC without success. Could you give me a sample program. I used command line RVIK* to read the variable but does it need to be converted back from a hexadecimal digit? I also tried RVSOB01* to read the a/d channel 1 directly but I don't know if it came back and I don't know how to convert it back to a Variable represented by A-D. I think my problem might be that I don't know how to convert the string reply back into a numerical variable that I can manipulate. Any suggestions?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:PLC-PLC Communication
« Reply #1 on: September 30, 2006, 02:58:51 PM »
If your PLC firmware is r47 and above you can use the "RA" hostlink command to read the ADC data of the slave PLC directly. However, for earlier PLC versions "RA" command is not supported, so you need to execute the ADC(n) command in the slave PLC to read the ADC port, e,g:

 DM[1] = ADC(1)

The above command will activate the ADC channel 1 which allows it to show up on internal variable for ADC #1. After that you can read the ADC value from either the DM[1] variable in the slave using "RVD" command, or you can use "RVS0B01" command to read from ADC channel 1.

NETCMD$ returns a string that includes the header and FCS, and so you have to extract out the data portion using the MID$( ) command. MID$( ) will return an ASCII string which you can convert into integer using either the VAL( ) command or HEXVAL( )  command, depending on whether the string is a decimal or hexadecimal representation of the actual value.

Another possibility is to use the READMODBUS command to read from the DM area of the slave (starting from offset address of 1000). It is straightforward and does not require you to extract string data or convert string to integer as READMOBDUS return a 16-bit integer directly.
« Last Edit: September 30, 2006, 03:03:08 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

Pneuman

  • Newbie
  • *
  • Posts: 2
  • I'm a llama!
    • View Profile
MASTER-SLAVE Communication
« Reply #2 on: October 02, 2006, 02:27:48 PM »
I have decided to use the READMODBUS & WRITEMODBUS commandS. The example works fine and the commands worked fine when I installed them on the master PLC. I am able to input on one PLC and output to the other PLC.  I am still not able to read my ADC channels from the slave to the master though.  I programmed in the slave DM[1]=ADC(1)and checked the on line monitor to make sure I had a changing value when I adjusted the analog input. That worked fine. Then I programmed into the master PLC:    DM[1]=READMODBUS(3,1,1001). I also tried using 1000, 1002 none of which gave me my #value for the ADC(1) when I monitored the master PLC program and changed the analog input on the slave.  I also tried to have the READMODBUS command = an alphanumeric variable directly with no luck. I am not a programmer but this seems straightforward enough. Can you help?

It works now. I used the README2 command and I am able to read all 8 ADC into the master plc starting address 1000 worked  for DM[1-8] ? offset 1000-1
« Last Edit: October 02, 2006, 04:22:11 PM by Pneuman »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:PLC-PLC Communication
« Reply #3 on: October 02, 2006, 07:20:33 PM »
The binary offset address for DM area is 1000 to 4999 (i.e. 4xxxx - 40001) so that's correct. If you use READMODBUS, it should be DM[1]=READMODBUS(3,1,1000) to read from DM[1] of the slave PLC into DM[1] of master PLC.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS