LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus 984 Addressing

Good afternoon all,

 

I'm working with a PLC unit that I'm using as a slave and running LabVIEW as the master and have run into an issue.  The VI's I'm finding for LabVIEW have a limitation on the addressing.  I'm guessing the VI's were written for an older protocol as they have an address limitation of 65535... however my hardware has addresses upwards of 428000+.   The hardware was purchased from Automation Direct and they told me that I could drop the 4 from the frontend of the address string but that doesn't seem to work. 

 

They're referring to it as "Modbus 984 Addressing".  Anyone familiar with this protocol or method of addressing? 

 

Thank you,

Chad

0 Kudos
Message 1 of 9
(2,198 Views)

In Modbus, addresses are 16 bit numbers, but there are overlapping addresses, as you have things like coils, holding registers and input registers, all of which start from the address zero. You use separate commands to work with the different options. To complicate it a little more, their number usually starts from 1, so coil 5, for instance, would be at address 4. Or possibly the other way around. There isn't always consistency.

 

Anyway, what they're telling you is that the first digit (4, in your example), tells you the kind of data you're working with and then the other digits tell you the address. In your case, I'm guessing 4 refers to holding registers so you would probably need to use the read holding registers command (which is probably a dedicated VI in the Modbus library you're using) and pass it the address 28000 or whatever you have.

 

In the past, at least, this addressing would use 1 digit for the type and only 4 digits for the address. It looks like in your case it's 1+5.


___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(2,179 Views)

tst,

 

Thank you for the response... 

 

Okay, I setup a loop with a numerical control for my starting address and set the default to the address specified, minus the 4... (28673)   I'm using a slider to simultaneously write to all four channels going to a small array since my module is a 4 channel analog output (0-10vdc)... the data register scale range is set to 0-100 in the PLC configuration software.  Modbus addressing is matching what I'm using... I can step the address up/down 20-30 points and no output.  Even though I'm sending a 50% signal to all four channels.   I'm using the same Write Multiple Holding Registers VI that's in the Modbus Master Example.  ...so I'm not sure what I'm doing wrong.  

 

Any other thoughts?

 

Thank you,

Chad

0 Kudos
Message 3 of 9
(2,160 Views)

@chuggins1434 wrote:

 

Any other thoughts?

A couple:

 

  1. Check the documentation to make sure you're actually doing things right (unit ID, protocol type, address, command, the PLC might need to be in a special mode to actually receive your commands, etc.).
  2. Look at the error you get. Is it a communication error or a Modbus error? What does it say?
  3. Try to perform other actions (setting a coil, reading, etc.).
  4. Try to use an external Modbus tester to remove your code from the equation. They can be tricky to find, but I believe there should be some.

___________________
Try to take over the world!
0 Kudos
Message 4 of 9
(2,137 Views)

Okay, I can confirm that I'm getting good comms... I have other modules attached as well that I can read and write to coils... two are relay modules that I can activate without issue...  As you mentioned there is an offset of one... the addressing starts at say 8193 and I have to set the start address going into the VI as 8192 to address all of the relays. 

 

I also have input modules (coils) that will go from False to True when it senses a signal to each channel.  Addressing for those in the PLC config software shows to start at 100065 (which again is above the normal Modbus addressing range)... so I removed the one from the front of the address and must start at 64 for them to signal.  That's all working fine...

 

I have error handling starting from my Create Modbus Instance VI all the way through to the Shutdown VI and I have no error coming out during runtime or shutdown.  

 

I have confirmed that the module works with an external driver (non-LabVIEW driven) so I know it's not just a bad module.

 

Now, all of my coil read/write have functioned with basically a blank program in the PLC... so I've been assuming that the AO module would work the same... might not be the case.  I'll do some more digging... 

 

Thank you for the feedback.

C

0 Kudos
Message 5 of 9
(2,124 Views)

Hey Modbus Gurus!

 

Okay, I have some kind of output now... found that the output I must used required some really odd math.  So Automation Direct support is telling me that I should have a 0-10vdc output when I put in a value of 0-100 (I set the scaling... it's adjustable in the configuration software).  However when I started I couldn't get anything out initially so I just made a slider with the full 0-65535 range on it... I found that I was getting an output when my input was above 16250... so I start by finding the values in that give me something out... collect some points between 0-10vdc out and plot it on an excel chart and play with the trendlines until I get a decent match.  What I find is that the input is a natural log curve!  So if I take the value I want to come out I have to put in the natural log of that value X 183.98 + 16250 and then it'll output approximately the correct voltage. 

 

Anyone have an idea of why this is?   ...it's easy enough to program that in, but I still want to know why!

 

Thanks!

Chad

0 Kudos
Message 6 of 9
(2,036 Views)

Hey Modbus Gurus!

 

Okay, I have some kind of output now... found that the output requires some really odd math.  So Automation Direct support is telling me that I should have a 0-10vdc output when I put in a value of 0-100 (I set the scaling... it's adjustable in the configuration software).  However when I started I couldn't get anything out initially so I just made a slider with the full 0-65535 range on it... I found that I was getting an output when my input was above 16250... so I start by finding the values in that give me something out... collect some points between 0-10vdc out and plot it on an excel chart and play with the trendlines until I get a decent match.  What I find is that the input is a natural log curve!  So if I take the value I want to come out I have to put in the natural log of that value X 183.98 + 16250 and then it'll output approximately the correct voltage. 

 

Anyone have an idea of why this is?   ...it's easy enough to program that in, but I still want to know why!

 

Thanks!

Chad

0 Kudos
Message 7 of 9
(2,038 Views)

Hi Chad,

 


@chuggins1434 wrote:

Okay, I have some kind of output now... found that the output requires some really odd math. 

 

collect some points between 0-10vdc out and plot it on an excel chart and play with the trendlines until I get a decent match.  What I find is that the input is a natural log curve!  So if I take the value I want to come out I have to put in the natural log of that value X 183.98 + 16250 and then it'll output approximately the correct voltage. 


You surely can link to a manual of that ModBus module!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(2,030 Views)

I can do that...

 

This is the CPU portion... 

https://www.automationdirect.com/adc/shopping/catalog/programmable_controllers/click_plus_plcs_(stac...

 

...and this is the actual module that's connected to the CPU...

https://www.automationdirect.com/adc/shopping/catalog/programmable_controllers/click_plus_plcs_(stac...

 

I'm using the Plasmionique Modbus Master (v1.3.6.1) library in my VI.  I have attached the VI I'm playing with... it's not great, but it's working for proof of concept.  

 

The two sliders for the AO signals are going into an array of 8 bc the addressing on the AO module skips every other value... not sure why, but it does.  This is working, again, not pretty, but functional.

 

The ClickPlusAOConverter1 VI is the odd math hoop I'm having to jump through to get a reasonable output.

 

I appreciate you guys taking a look.

 

C

 

 

Download All
0 Kudos
Message 9 of 9
(2,022 Views)