Jump to content

Recommended Posts

So I got hold of a remote I/O which a would like to control over TCP with Visilogic (Samba 7), however I can not make head nor tail of the register table.  Could anyone give me some pointers as to how to read this type of table please, or give me a link to a tutorial.  I have looked, but without luck so far.

 

Thanks

Modbus register 1.JPG

Modbus register 2.JPG

Link to post
Share on other sites

That table was created for some who understands Modbus to the byte level.  You don't need to go that deep to use this module.

The DI's and DO's are also known as coils and will equate directly to MB addresses.

The AI's are called "holding registers" and represent 16 bit signed integers, also known as MI addresses.

This table can be totally confusing because they list the same "register address" of 0x00000 for both DI1 and AI1.  If you don't know Modbus, you'll be like "What the hell does this mean?"

In ModbusSpeak, coils are their own data type and always start with a real 0 followed by the address to four significant digits  And start at 1, so DI1 would properly be 00001.  Unitronics adds to the confusion by starting at 0, so DI1 corresponds to MB 0.

Registers in Modbus start with a 4, so AI1 would be 40001.  Unitronics calls this MI 0.

Look in the Examples for Modbus TCP and you'll see what's needed to read and write your device.

After you do this post your program with questions.

Joe T.

Link to post
Share on other sites

On top of what Joe says, my experience of many modbus devices from "lesser known" makers, especially those from Asia, is that they often don't follow normal conventions.  You often need their special program to change crucial settings so that you can then communicate with it in the normal way.  Perhaps your device is not one of these, but be aware of the possibility.

cheers, Aus

 

Link to post
Share on other sites

Hi Guys, thanks for the pointers.

In case this may help anyone else with similar newbie problems, here is what I have done so far.

One of the things I noted while reading through the forum was to always use Modbus testers before trying put together a program.  I had a hunt around, tried various freebies, and so far I have discovered a few things about the device, which as Ausman correctly guessed comes from Asia.  http://www.hi-flying.com/hf6208

Using Modbus Poll Test Center, I managed to turn on and off the output relays by copy pasting the various instructions from the manual

606162961_ModbusPoll1.JPG.2de76bf69d8a0b2b93a45c322f680568.JPG

But this did not help with identifying what was going on elswhere.  So using CAS Modbus scanner I managed to get the following :

1589723248_CASDiscover.JPG.f08d78dcbebab0daa7869ee77afc9d59.JPG

I then used the same tool to check the addresses with function 01 and got the following

289560307_CASFunction1.JPG.568600c81c80aa3b3c8fbd6285df86d2.JPG

Function 2 gave me this

1354198436_CASFunction2.JPG.3ab22a137063b92f767eb29b35355e02.JPG

Function 4 gave me this

1353242951_CASFunction4.thumb.JPG.c48be94d6ed698a4e82b2e15838b9502.JPG

At the moment there is a single analogue input, a single digital input, and 7 relays on and one off.

So far so good, I can read the status of everything, but I am still having problems with function 5.  With the exception of Modbus Poll Test Center, every other test i have tried strips out the two zeros after the function bit.  i.e. I try to send 01 05 00 10 00 etc, but only manage 01 05 10 00 00 etc, which returns an error.

Can anyone enlighten me as to what is going on?

Cheers

 

 

Link to post
Share on other sites

I did a test program to try and work this all out.  Very frustrating.  I have tried using the addresses I found with CAS Modbus Scanner (shown in previous post), in both decimal and hex.  I have not been able to read or write anything at all to the device with Visilogic. 

I then realised that every time I tried to send a message, the status operand was giving me 4 for each attempted send, than going to 5 when finished.  This leads me to believe that the communications are the first problem to solve.  I have looked at the examples, but can not see anything different to what I am doing.

The remote IO device works fine with both CAS Modbus Scanner and Modbus Poll, so there should not be be any communications issue.  SB147 tells me that the socket is connected, i am not sure what to do next.

 

Test program Modbus TCP with constants.vlp

Edited by Patrick
Upload new copy of program with constants
Link to post
Share on other sites

Hi, in code you use some operand to configure slave register (coil) address and slave register vector length but it is not placed correct numbers to this operand in program.

Please define correct slave register (coil) address (place constant or set needed numbers to operand).

Slave ID need to be 1 as in PC dialog

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...