From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String to Number conversion in an Array for use with MODBUS

Solved!
Go to solution

Hi Everyone,

I am doing this project to read and Write Data into a TemperatureController using Labview over Ethernet. 

 

Though, I have figured a way out to do that, I have a slight problem. I realised that MODBUS does not deal with Floats.

 

I need to feed into floats into my system so that the Temp Controller may read a value correctly. For example, at the moment to get a value of 35 into the Controller I need to feed in the value  350 into LabVIEW. 

 

I was following some threads such as

http://forums.ni.com/t5/LabVIEW/Convert-2D-string-array-to-2D-number-array/td-p/626652

for possible solutions. 

in one case the use of String to Number converter using arrays has ben put up. I tried the same solution in my VI but I am getting a Broken Wires  error. 

 

Could someone help me understand what is the mistake I am doing here ! 

 

Any help would be deeplya appreciated !

 

Kind Regards,

Jalashwa

 

 

 

 

 

0 Kudos
Message 1 of 3
(3,127 Views)
Solution
Accepted by topic author Jalashwa

The problem in your image is that you have multiple broken wires.  In one case you have two sources on the wire (array control of registers to write and the output of the scan from string).  Also you have an array of strings wired into Scan From String.

 

"I realized Modbus does not deal with Floats".  Actually, it can.  Often you will have a single precision float, it gets spreads over two U16 registers.  You'd use the join function on the numeric conversion palette, and typecast to make it work.

 

But in your case, it sounds like the controller is doing some scaling on the value (either divide by 10 or multiply by 10) so that you can fit a larger value into a single U16 register.  So you'd just multiply or divide by 10 in LabVIEW to convert to the number you want to put into the controller.  I don't know why you are messing with Scan from String at all.

Message 2 of 3
(3,115 Views)

Yeah RavensFan, I was overcomlicating matters. Thanks for yourn help as always

 

Cheers !

 

0 Kudos
Message 3 of 3
(3,036 Views)