03-10-2018 05:42 AM
Thanks. I am new to Labview and I think I will continue with the VI and the Modbus library I have now.
03-10-2018 11:21 AM
@dotis10 wrote:
My "Single precision float" seems to be different from the typecast output. Pink vs orange? 😐
A couple of values have two register addresses next to each other in the read register (due to float?). For example "Temperature (Secondary Value), degrees C, register 1010-1011".. Does these values have to be merged before the type casting? Or how does that work? And if I want to read values from different addresses, with different units - how do I handle that?
In order logg data from, lets say the temperature over 60sec or so, do I connect the typecast output to the Signal on the Write to Measurement File?
You wired in a string constant. You need to wire a constant that is a single precision float. If you have multiple addresses, make that constant a 1-D array of single precision floats. It witll then convert it to an array of 1-D SGL's.
03-10-2018 02:25 PM
@RavensFan wrote:
@dotis10 wrote:
My "Single precision float" seems to be different from the typecast output. Pink vs orange? 😐
A couple of values have two register addresses next to each other in the read register (due to float?). For example "Temperature (Secondary Value), degrees C, register 1010-1011".. Does these values have to be merged before the type casting? Or how does that work? And if I want to read values from different addresses, with different units - how do I handle that?
In order logg data from, lets say the temperature over 60sec or so, do I connect the typecast output to the Signal on the Write to Measurement File?
You wired in a string constant. You need to wire a constant that is a single precision float. If you have multiple addresses, make that constant a 1-D array of single precision floats. It witll then convert it to an array of 1-D SGL's.
Can't get it to work... How do I get the "type" to be orange instead of pink?
03-10-2018 02:37 PM - edited 03-10-2018 02:37 PM
@dotis10 wrote:
@RavensFan wrote:
@dotis10 wrote:
My "Single precision float" seems to be different from the typecast output. Pink vs orange? 😐
A couple of values have two register addresses next to each other in the read register (due to float?). For example "Temperature (Secondary Value), degrees C, register 1010-1011".. Does these values have to be merged before the type casting? Or how does that work? And if I want to read values from different addresses, with different units - how do I handle that?
In order logg data from, lets say the temperature over 60sec or so, do I connect the typecast output to the Signal on the Write to Measurement File?
You wired in a string constant. You need to wire a constant that is a single precision float. If you have multiple addresses, make that constant a 1-D array of single precision floats. It witll then convert it to an array of 1-D SGL's.
Can't get it to work... How do I get the "type" to be orange instead of pink?
Nvm, solved that part x)
03-10-2018 05:00 PM - edited 03-10-2018 05:01 PM
Is this what you meant for the multiple register addresses? 🙂
Do I have to merge the two addresses of ex. the Temperature somehow? Before or after the typecasting? How are these two values really divided? And how are they merged in theory?
03-10-2018 10:51 PM
Yes. That is what I meant.
This assumes you are reading multiple registers in a row. If you are not, then you need multiple reads anyway.
If you read two registers that represent a single floating point number, you get an array of 2 U16 elements. The typecast will turn that into an array of 1 SGL element. If you want two floating points, you'll read 4 registers, so that 4 U16's in an array will come out as 2 SGL's in an array after the typecast.
03-12-2018 03:16 PM
Thank you RavensFan!
So if I for example only want to read the temperature in reg. 1010-1011 and the pressure in 1033-1034 for example, in one shot, how can I do that?
Do I add another Read Input Reg?
03-12-2018 04:08 PM
You could try reading registers 1010 to 1034 (start 1010, number 25) Then index out the first two and last two registers and convert them. If they were closer together, I would do that. That far apart, I'd just do them as two separate reads.
You can try it out both ways and see if one is faster than the other.
03-12-2018 04:29 PM
@RavensFan wrote:
You could try reading registers 1010 to 1034 (start 1010, number 25) Then index out the first two and last two registers and convert them. If they were closer together, I would do that. That far apart, I'd just do them as two separate reads.
You can try it out both ways and see if one is faster than the other.
Okay, nice! I will try index them out.
And by "two separate reads" do you mean I will use two "Read Input Register"-blocks and use the same slave IDs but different starting addresses?
03-12-2018 08:34 PM
@dotis10 wrote:
@RavensFan wrote:
You could try reading registers 1010 to 1034 (start 1010, number 25) Then index out the first two and last two registers and convert them. If they were closer together, I would do that. That far apart, I'd just do them as two separate reads.
You can try it out both ways and see if one is faster than the other.
Okay, nice! I will try index them out.
And by "two separate reads" do you mean I will use two "Read Input Register"-blocks and use the same slave IDs but different starting addresses?
Yes