Twido To Advantech Adam 6000 Modbus TCP

C

Thread Starter

Controls Guy

Does anyone have an example program for a Twido talking Modbus TCP/IP to an Advantech Adam-6000 series I/O module? I can't get it to work, and I don't know what I'm doing wrong. I'm pretty sure I have the tables set up correctly in the Twido. What should the unit ID be for the Adam module? You can e-mail me at [email protected]. Thanks.
 
C

Controls Guy

It's an ADAM-6051. There are tables in the Twido Software to Read N Bits of data. The Control and Transmission tables are set up as follows (values are in hex):

MSB LSB
%MW50 := 16#01 06 (Trans/recept) (Trans lngth)
%MW51 := 16#03 00 (Recpt offset) (Trans offset)
%MW52 := 16#01 02 (Slave #) (Request code)
%MW53 := 16#00 01 (Address of 1st bit to read)
%MW54 := 16#00 0C (Number of bits to read)

This is how things are set up on the Twido end for the Modbus control table to read the 12 inputs. It seems right to me. I have also tried a request code of 01.

The Advantech ADAM-6000 series manual in Appendix B, there is a Command Head and Command Body shown. Is there a correlation here between the setup from the Twido and the Command Head and Body in the Advantech?
 
M

Michael Griffin

The "Command Head" and "Command Body" are just Advantech's name for parts of the Modbus/TCP message. The proper names are the MBAP (MODBUS Application Protocol header) and the PDU (Protocol Data Unit). These are part of the protocol, and should handled by the software in the master (the Twido).

As another poster said however, make sure the Unit ID is set to "1". The Unit ID is used to route messages to serial ports (for Ethernet to serial converters). Advantech uses this even if there isn't a serial port on the device you bought. The local Unit ID is "1". Anything higher is assumed to be intended to be routed to a serial port (where it is used as the serial slave address). This way you can have a number of RS-485 serial Modbus/RTU modules connected to an Ethernet module.

Sorry, but I can't help you with problems with the Twido itself. Make sure you can ping the module. Make sure you are using the correct Ethernet address. Make sure the address used for the slave is accessable to the address range used for the master. Etc.
 
M

Mike Berryman

The quirky thing about the ADAM-6000 modules is the Modbus addressing for both Inputs and Outputs are lumped into the Output address range. The ADAM-6051's 12 DI channels are not located at the typical 1X Modbus address range. They are located at the 0X Modbus address range which is usually reserved for DOs. For the ADAM-6051, the 12 DI channels are mapped to Modbus addresses 00001 - 00012 In order to read these addresses, you may need to set up the PLC to perform a 'write and read-back' to this range.
 
C

Controls Guy

Mike and Michael,

Thanks for the replies. I have set the unit ID to 1. The two devices see each other. Someone else told me to use Wireshark and I set up a managed switch to do some port mirroring on the Twido. The Twido is at address 192.168.2.181. The Adam is at 192.168.2.160. Below is some of the data from Wireshark, abbreviated:

Source Dest Info
181 160 TCP ACKed lost segment 1035>502 Seq=0
160 181 502>1035 [ACK] Seq=1 Win=256 Len=0

160 181 TCP Dup ACK 36#1 502>1036 ACK Seq=1
181 160 1036>502 Seq=0 Len=0 MSS=1460
160 181 TCP Dup ACK 36#2 502>1036 ACK Seq=1
181 160 1036>502 Seq=0 Len=0 MSS=1460
160 181 TCP Dup ACK 36#3 502>1036 ACK Seq=1
181 160 1036>502 Seq=0 Len=0 MSS=1460
160 181 TCP Dup ACK 36#4 502>1036 ACK Seq=1
181 160 1036>502 Seq=0 Len=0 MSS=1460

This stuff is basically repeated throughout the Wireshark file. The Dup ACK number keeps changing (37, 38, 39, etc.). Does this tell you guys anything?

Mike, if I try to do a 'write and read-back', what do I write to the inputs? Do I write to the same addresses (00001 - 00012) and then immediately read from them? With the Twido, the EXCH3 command needs to be used to perform multiple reads and writes. Unfortunately, you can only do one function (either read or write) with EXCH3 at a time. Do you think that could be a problem?

Thanks again.
 
M

Mike Berryman

Sorry but I'm not familiar Twido programming, but if you've set it up to Read from 00001-00012 that should work. I see from the Wireshark capture that the proper Modbus/TCP TCP/IP port of 502 is being used - so that's good. Wireshark is a great tool and can also allow the viewing of the specific Modbus data.

I'm glad to see you've opened a support case with Advantech - I'll make sure the tech support person assigned gets this background so we can get to the bottom of this issue.
 
M

Michael Griffin

What I would suggest doing at this point is to try polling the ADAM module with a Modbus/TCP client program on your PC, and see if you can talk to it. Then set up a Modbus/TCP server program and see if the PLC can poll that. This will tell you which end the problem is at.

There are free programs which you can get to do the testing with. I have a project at http://sourceforge.net/projects/mblogic/ which has several different packages. There are others as well, if you want to look for them.
 
C

Controls Guy

So it's been a few weeks, but I finally got this working. I was reading in the Advantech documentation yesterday that the modules can also do peer-to-peer messaging. I was going to try to set this up in the Adam.NET utility, but it was grayed out. I then read in the Advantech manual the firmware had to be 3.x or later to utilize the peer-to-peer function, and I had 2.x. After upgrading the firmware, I thought I'd give the communication with the Twido another shot...low and behold, it started working.
 
Top