Modbus TCP connection problem


CamEra

Recommended Posts

Hi,

I am trying to talk to a SEW Eurodrive gateway to an LT E B Movidrive interface.

I have set up a new device called Movidrive and set the IP address as required (default is 192.168.10.4) and the port to 502 (see section 8 in manual attached).

I have set up a simple scheme to read a holding register U16 Single but no matter what address I put in it gets nothing - seems to timeout.

I have set up Modbus RTU before without trouble so I think it is probably just the addressing. I have tested that the computer can see the device with ping - which can see it. The device and data can be seen by the SEW company's software.

Perhaps if you look at Section 8 in the manual you may be able to help me.

Thanks

George

Link to comment
Share on other sites

  • 3 weeks later...

Hi Matt,

Firstly I must thank you for your time on the phone the other day to sort out my connection problems with the SEW Eurodives Modbus TCP connection. Your knowledge and help confirms to me that I made the correct choice in using DaqFactory - by far the best product support I have had.

Just one question. As discovered we need to read or write at least 3 words to our device. As it turned out when we had two devices connected the data appears in the next 3 words. You may remember that addresses started at 4, so the first device words were 4,5 and 6, the second device is 7,8 and 9. It appears to read or write to the second device we need to read or write to 6 addresses - so to write we need

device.Movitrac.SetRegisterS16(255,4,{518,16384,2730,518,8192,2730})

No problem there but I would like to use a variable so used

speed=8192

device.Movitrac.SetRegisterS16(255,4,{518,speed,2730})

which produced an error because it could not understand the value for speed. I didn't think this was a string as it wasn't in "" so I guess in DaqFactory speed is a floating point value when I need an integer. Do you think this is likely to be the problem?

Thanks

Link to comment
Share on other sites

No, that is not the problem. The problem is that the {} notation can only have constants in it, no variables. What I'd do is create a single variable for the output status, that is an array of 3 elements for each device. So if you had 2 devices, you might init it like such:

global deviceout = fill(0,6)

or init it with constants using {}

global deviceout = {518,16384,2730, 518,8192, 2730}

Then when you want to change the output, you change the appropriate array element in this variable then send the whole variable:

deviceout[1] = speed

device.movitrac.setregisterS16(255,4,deviceout)

Also, I'd imagine you can do everything in sets of three. You should be able to do:

device.movitrac.setregisterS16(255,7,deviceout2)

or similar as long as deviceout2 is an array of 3 values.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.