LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

32bit float value from analyzer


@sandy1234 wrote:

Again my question is how to pull a range of holding register from 40001-40050.By creating a single variable with the range? 

 


The above solutions will create a single array output. If this is not what you want, define what you mean by "a single variable" and "range". These terms are very ambiguous.

0 Kudos
Message 11 of 24
(1,086 Views)

Yes.  Take your array of 50 U16 integers, and type cast that to an array fo SGL floating points.

 

You may run into endian problems.  If the above functions don't give you the numbers you want, then, you could decimate the array into two 25 element arrays, and do a join and typecast inside of a loop.  there are probably a few other ways that you could use to get the final results.  The "Swap Words" function might come in handy in some of them.

0 Kudos
Message 12 of 24
(1,077 Views)

Hi,

 

Thanks guys I will try this in a couple of days and update here the result...Cheers

 

Sandy

0 Kudos
Message 13 of 24
(1,073 Views)

@sandy1234 wrote:

Again my question is how to pull a range of holding register from 40001-40050.By creating a single variable with the range? 

 

Sandy


Is it correct that an array will be what you call a single variable? If so, yes a "single variable" (array) can contain the whole range.

If i understood you correctly in an earlier post you have managed to read two registers, combine them and cast them to a SGL. Then you know how to read a register.
I suggest creating a for-loop for reading 50 registers and collect the values on the output of the for loop with an indexing output. You will automatically get an indexing output on a for loop if you connect a wire from the inside to the frame. I do not know how you read one register, but i assume you need to create a way of automatically calculate the register number inside the for loop based on adding the indexing variable to first register address.
Out of the for-loop you now have an array with 50 INT16. Use my earlier solution or cbutcher's solution to convert the 50 INT16 to 25 SGL.

0 Kudos
Message 14 of 24
(1,062 Views)

@sandy1234 wrote:

Hi,

 

Thanks guys I will try this in a couple of days and update here the result...Cheers

 

Sandy


If you have problems, then sharing the code you're currently using to read the first two registers will make it easier to give you advice on how to do the same for a larger number of registers (or really, to give an example, since there are already numerous pieces of advice that describe possible solutions).


GCentral
0 Kudos
Message 15 of 24
(1,053 Views)

Hi,

 

Attached the code which I tried by creating just two 16bit registers ie 40005 and 40006 and it was working (My laptop LV2014 is having some problem while deploying so tried in another PC).

 

Regards

Sandy

0 Kudos
Message 16 of 24
(1,044 Views)

I am a little bit more outdated than you, sandy1234. Could you save it for LabVIEW 2012?

0 Kudos
Message 17 of 24
(1,031 Views)

The saved VI shows the use of Shared Variables to access the registers.

This method is I think what is described here: Connect LabVIEW to Any PLC With Modbus (perhaps Sandy can confirm this is the method being used)

 

Alternatives can be found here: Introduction to Modbus using LabVIEW.

In particular, you can see in Figure 3, for example, reading multiple values into an array.

That might significantly aid your progress.

 

As a following option, if you prefer the NSV, you can programmatically access them by name (but then you'll need to use the names and generate those in a loop, for example a For loop with a fixed number of values, or autoindexing through a list (probably more messy if your registers are continuous).


GCentral
0 Kudos
Message 18 of 24
(1,027 Views)

cbutcher, both links point to same page. Is that correct?

0 Kudos
Message 19 of 24
(1,022 Views)

@RolfO wrote:

cbutcher, both links point to same page. Is that correct?


Oops! Copy-paste fail.

 

First link should be this one: Connect LabVIEW to Any PLC With Modbus


GCentral
0 Kudos
Message 20 of 24
(1,019 Views)