LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search string value to return integer

Hey guys,

 

Below, I'm loading values from the front panel of a programmable power meter via rs232.

 

The problem is, the power meter sends this info as a string of voltage, current and power, as you can see below in the first image into he box titled 'request - this is the data received back from the meter'.

 

I was really hoping to be able to receive an integer value for the power (the 0.81 number), I've had go at using scan string but really stuck with where to actually start with it.

 

I would really appreciate it if one of you guys could direct me towards to how I should use the scan string to only get the value of power out of the string.

 

Thanks in advance

 

Dan

 

block.jpgVI.jpg 

Message 1 of 5
(2,915 Views)

See attached example..

May be it will be helpful.Smiley Wink

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
Message 2 of 5
(2,906 Views)

Thank you so much for your response, I now have the power being ouput as an integer!

 

I would be ever so grateful if you could help me a little bit more,

 

i have now found that the input string is not always complete, sometimes it ends at U=(a value) and does not contain the data for the current or the power.

 

Naturally, this causes an error with the data not being in the expected format as defined by the search string function if I am using a loop to continously monitor the power.

 

Is there a simple way of getting Labview to just wait for a complete string rather than stop the loop due to the error?

 

Thankyou again for your help

 

Dan

0 Kudos
Message 3 of 5
(2,896 Views)

Yeah, read from the port and if you don't have enough data, read some more and append it to the string you read the last time.  Use a loop with shift registers to propagate the the previous string and concatenate string to append to it.

 

 

A

0 Kudos
Message 4 of 5
(2,868 Views)

Have you looked into using the termination character of your device that you are reading from.

Most devices will end a message with a return or new line. 

Set the termination character read mode of your comport to match that of your device.

 

Omar
0 Kudos
Message 5 of 5
(2,824 Views)