Jump to content

Mobus reading and writing Double words third party


Mark s

Recommended Posts

I am working with a third party Modbus Analog I/O module.

The analog input address that I read from is 300001( double word). In the master, I read input holding register for address 0 and get the correct value. In the PLC the tag is a int32

The analog Output address that I need to write to is 400001(also double word).  I have tried writing a int32 into 0,1,2,3 in the slave. I have written to 40001 I have tried changing between single and multiple writes. I change what I was writing from to int16's and wrote four words.  I have looked through most all the documentation I can find and haven't been able to get an understanding of how to write to that register that has the same 400001.

Link to comment
Share on other sites

serial or TCP/IP MODBUS? I was reading appxc.pdf

this document. So you can read but not write? The Unilogic MODBUS setup is fairly straightforward, most likely an addressing issue. Third party PLC is probably getting the write request packet(s) and just doesn't know what to do with it, or writing to the wrong place??

http://www.simplymodbus.ca/faq.htm

300001 and 400001 (decimal) are a typo? An extra zero? Max analog write address appears to be 49,999

  • Like 1
Link to comment
Share on other sites

2 minutes ago, hotwires said:

serial or TCP/IP MODBUS? 

300001 and 400001 (decimal) are a typo?

An extra zero? Max analog write address appears to be 49,999

I was thinking the same thing.  

I sure hope it was a typo...

I can't believe anyone would set up a program that interpolated  them with that range.

One thing he may want to try is get Modscan or equivalent and test it real quick.

Link to comment
Share on other sites

iopic.png.1e9a6aff906380a9c47836c88c500c5f.png

This is a screen pic of the io information pulled from the Netedit 3 Configuration utility.

It was my understanding that the 3 and the 4 were Identifiers of Modbus  read  and write holding registers.

When I read the analog Inputs I use the read input registers (4)  and use a value of 0 and I get back the value that is in register 300001. The offset because the module uses one as the first register.

When I use the same logic in reverse I send the set holding register (6) or multiple (16) and give an address of 0 or 1  or 2  it does not make it into the register.

I even moved the input registers into aperiodic tables set to gen.off so I was sure nothing else was happening in the unit. I use decimal numbers on the address and the values returned are in decimal and I could not find a reference to the outputs being in Hex. But I tried that too and it was no use either.

I'm new to this forum and I am unsure if the pic is displayed clearly.

Thank you

Link to comment
Share on other sites

Mark S.

Thanks you, the screen shot you provided helps bring the picture of the third party hardware into focus. Still intrigued by the 300,001 and 400,001 decimal MODBUS address. I'll have to process this for a while. I'm sure the addition info you posted will accelerate an answer to your troubles. 

Please clarify:

"When I read the analog Inputs I use the read input registers (4)  and use a value of 0 and I get back the value that is in register 300001. The offset because the module uses one as the first register."

where you say "value of 0" do you mean address of 0?

have you tried registers periodic, write, (16), address 40001? Or 40000 accounting for offset. 

Unilogic's  valid MODBUS address range is 0 to 65535, so the 400001 is out of the question.

Modscan is great idea. It's referenced in the automation direct manual (see photo). 

 

IMG_4428.PNG

This is an @Joe Tauser question. My best battles are fought and won with gear that is at my fingertips. Or someone lifetime of real world experience.... which I'm still working on. 

ch3.pdf

appxf.pdf

 

 

  • Like 1
Link to comment
Share on other sites

question of the address I am asking for.  

This is a pic of the analog inputs. I moved them to aperiodic so I am sure the only thing I am doing is writing to the outputs

The analog outputs I am writing to are in periodic. I will put the analog inputs back periodic as soon as I figure out what I am doing wrong with the  outputs.

ainputpic.png.df9815cb834a7e42950fd077b4a0366d.png

 

The analog outputs

I have tried writing both (6) and (16). I have tried 40000, 40001. I have also tried writing to the entire module. I.E 40000~40007. as well as 40001~40008 Also using 0~7

 as well as just about every combination I could think of.

I even tried sending four int16 to the first two words to see if I could at least figure out where the numbers are "landing" in the module.

I have routinely "Download all"ed the program as I have had issues not getting changes to download on another project, hasn't happened on this project. 

 I have also tried writing to another module in that rack.

I was using another similar Modbus program to "look" into the modules to see the numbers in the registers of the modules . Upon a suggestion  of dierkens I downloaded modscan64. It reported the same as I was previously getting.

 

Also note: when reading input coils I use Read Discrete Inputs (2) and the address of  0,1,2,3... and get the input status . to set a coil I use Write Multiple Coils (15)and the address of  0,1,2,3... and can turn on the respective outputs, again they are offset by one but no other issue.

Thanks to everyone for their help. I am sure I am not doing something correctly, I just haven't figured out what that is yet!

Link to comment
Share on other sites

I have no explanation of why. I am sure I was doing something wrong. This morning it appears to be working correctly. I down loaded the address of 40000 and 400002 nothing new. Started back through the process 40001 and 40003 even extended to the whole module. then I started in with 0 and 2 and it worked.. I have no clue why. 

I Write Multiple Registers (16) to an address of 0  and the values show up in 40001, and I have no clue why today and not yesterday...   

 I powered down yesterday in the thought I had something "jacked up" with my computer, the PLC, the Distributed I/O. apparently I was doing something wrong..

Thanks again, to all of you for your support

 

Link to comment
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...