LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read out and convert Modbus registers

Solved!
Go to solution

I'll take care of you.

can you save the two VI's in 2012 version, because I work with it.

thank you

0 Kudos
Message 11 of 22
(1,142 Views)

Hello,

It worked. I was able to read the value from the register and convert it too.

My next question is:
I have 3 registers and need to output 3 voltages at the same time. How would it work. Do you know?

Here is a picture of how I programmed it

 

JuniorLabview_0-1641578680799.png

 

0 Kudos
Message 12 of 22
(1,132 Views)

@JuniorLabview wrote:

My next question is:
I have 3 registers and need to output 3 voltages at the same time. How would it work. Do you know?

 

 


Three SINGLE registers or three two register values?

Are all the registers in sequential addresses?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 13 of 22
(1,130 Views)

So each register has 2 values that are then translated.
Example
Register 1 = 1234, 5678
Register 2 = 1234,5678
Register 3 = 1234,5678
Result
Register 1 = Voltage 1
Register 2 = Voltage 2
Register 3 = Voltage 3

0 Kudos
Message 14 of 22
(1,127 Views)

all registers are in one address

0 Kudos
Message 15 of 22
(1,122 Views)

@JuniorLabview wrote:

So each register has 2 values that are then translated.
Example
Register 1 = 1234, 5678
Register 2 = 1234,5678
Register 3 = 1234,5678
Result
Register 1 = Voltage 1
Register 2 = Voltage 2
Register 3 = Voltage 3


I don't understand you are saying one register is holding two values?  Most common Modbus registers are a 16bit unsigned integer (U16). Where's the comma coming from? Is it two 8bit values being held in one 16bit register?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 16 of 22
(1,119 Views)

No, that's not a comma.

the values that are in the register, it is a word, are each 2 bytes in size and a total of 4 bytes. and 4 bytes is also exactly the size of a float 32.

0 Kudos
Message 17 of 22
(1,115 Views)

@JuniorLabview wrote:

No, that's not a comma.

the values that are in the register, it is a word, are each 2 bytes in size and a total of 4 bytes. and 4 bytes is also exactly the size of a float 32.


So each register is one 32bit register?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 18 of 22
(1,111 Views)
Solution
Accepted by topic author JuniorLabview

Okay I took the time to track down a manual and skimmed it... BTW: I suggest you study this manual very closely

 

registersCapture.PNG

Uln1 base address is 1100h

Uln2 base address is 1102h

Uln3 base address is 1104h

 

That means each measurement uses two registers.

 

Now if I were going to get all three voltage measurements at the same time. I would read all six registers at once (start at 1100h and set the number of registers to read to 6). That would then output a U16 array of six elements. Index the elements and convert them using the combine and convert VI I gave you.

 

6reg.png 

========================
=== Engineer Ambiguously ===
========================
Message 19 of 22
(1,102 Views)

I don't know what to say. I can only say thank you very much for your effort. I will be able to test it on Monday.

Thank you very much and have a nice weekend

0 Kudos
Message 20 of 22
(1,085 Views)