취소
다음에 대한 결과 표시 
다음에 대한 검색 
다음을 의미합니까? 

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 포인트
11/24 메시지
1,568 조회수

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 포인트
12/24 메시지
1,559 조회수

Hi,

 

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

 

Sandy

0 포인트
13/24 메시지
1,555 조회수

@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 포인트
14/24 메시지
1,544 조회수

@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 포인트
15/24 메시지
1,535 조회수

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 포인트
16/24 메시지
1,526 조회수

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

0 포인트
17/24 메시지
1,513 조회수

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 포인트
18/24 메시지
1,509 조회수

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

0 포인트
19/24 메시지
1,504 조회수

@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 포인트
20/24 메시지
1,501 조회수