LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert data from serial port to an integer????

I am sending the adc reading on serial port and i want to convert the data acquired from serial port to an integer and plot it on the graph.so, how can i get the continuous data from serial port?

also help me to convert serial data to an integer.

0 Kudos
Message 1 of 6
(4,234 Views)

Reading from a serial port - use the serial VIs located in palette under Instrument IO:Serial.  There you will find various VI's such as configure port, read, etc.

 

To convert your data, I would suspect the string conversion VIs in the palette under Programming:String:Number/String Conversion would do the trick.  There you will find various VI's that will convert almost any format string into a numeric such as a decimal string "123" into a decimal 123 or a double 123.0, etc.  The one you want is most likely Decimal String to Number, but that depends on the particular format of your string.

0 Kudos
Message 2 of 6
(4,225 Views)

Don't use the Serial functions.  Use VISA.  Trust me on this, it is a much better interface.

 

Look in the LabVIEW Example Finder (Help->Find Examples) and looks for a Simple Serial Write & Read (or something like that).  It is a decent start for learning to use the API.

 

Now for converting the string data, well that totally depends on the format the instrument is putting out.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 6
(4,218 Views)

The "serial" palette VIs are actually VISA (at least in my palette).

0 Kudos
Message 4 of 6
(4,204 Views)

You need to change only string to interger

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 6
(4,196 Views)

@Ranjeet_Singh wrote:

You need to change only string to interger


I guess in strict technical terms, that is correct.  If you want to turn them into meaningful integers, you have to know the format, as @crossrulz pointed out.  (Which, of course, could bring us full circle and your solution is the correct one, after all.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(4,174 Views)