LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port to .csv file to graph

Solved!
Go to solution

I am using LV 8.0

hello i have attached .csv file . I am able to read the file through the VI file i have attached.But i want to make the graph of these values.

This .csv file will be coming from serial port so please tell me how to fo this.I have read the examples attached but i am not able to convert it to read a .csv file.I am using Serial port.

I searched for examples on internet, availabe examples  are on labview 8.2.so please guide so that i can go on with my project.

 

Thanx and Regards

 

Divyansh Gupta

Download All
0 Kudos
Message 1 of 7
(5,733 Views)

You first said that " I am able to read the file through the VI file i have attached", but then you say that " have read the examples attached but i am not able to convert it to read a .csv file". These are contradictory statements. That VI will read the file if you set the delimeter control to be a comma. So I don't quite understand what the issue is with reading the file.

As for graphing, simply place a waveform graph on the front panel, and connect the array to the graph terminal. Done. Have you looked at the examples that ship with LabVIEW? I have no idea what examples on the internet that you might be referring to.

 

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

 

0 Kudos
Message 2 of 7
(5,732 Views)

 

Hello i have used read from spread sheet to get the .csv file.Can you specify which graph should i use i attached a graph but nothing is displayed on the graph.

 

Yes i am able to read the file that is saved on the computer but i am not able to recieve the file from com port and convert it into graph.

I have attached a .csv file in previous post.Serial port is outputting data in that format.

 

I am a Newbie i know this stuff is simple but i need practice.Due to some time constraint i posted this message.Please guide me forward.

 

Thanx and regards

Divyansh

 

 

0 Kudos
Message 3 of 7
(5,728 Views)

Hello i am able to see the waveform from the .csv file which is on my computer.But i am not able to get direct values from serial port and display on the graph.

Can somebody share any code.

I am using LAbview 8.0

 

As i said eariler i am working on it.

0 Kudos
Message 4 of 7
(5,704 Views)

So if I understand correctly now, you can read a saved file and graph it?

 

Your question regarding the serial port is a different matter. Are you reading the data one point at a time, or are you reading a whole list of values over the serial port. The first would mean that you probably want to use a waveform chart as opposed to a waveform or XY graph. If you read a whole list then it doesn't matter which one you use. A waveform chart would be the simplest to use in this case. In terms of actually reading from the serial port, again, look at the examples that ship with LabVIEW. Open the Example Finder (Help -> Find Examples) and search for "serial". There's a "Basic Serial Write and Read" that you can look at to see how it's done. The specific on how you do it with your instrument depend, of course, on your instrument. Pay special attention to any delimeters that are used to end a command or a read. 

0 Kudos
Message 5 of 7
(5,693 Views)

Hello,

Thanx for guidance i found the examples,i am able to see the data which i am transferring from serial port.

 

My data is coming continuously this will give you an idea.Below is a dialog on COM port...

 

Start

329,337,333,332,336,329,335,336,327,335,334,330,337,330,333,338,328,337,334,330,337,331,333,338,329,336,337,329,337,333,332,338,331,336,339,331,335,334,332,339,332,335,340,331,336,335,332,340,333,335,342,332,338,338,332,341,336,333,342,335,337,340,333,340,337,334,343,336,336,342,335,339,337,335,344,337,336,344,337,341,342,335,343,341,336,344,339,340,345,337,345,342,337,347,340,341,344,339,346,345,339,347,345,342,347,341,345,347,340,348,346,343,349,344,347,350,341,348,346,343,351,346,348,352,343,350,353,345,352,350,346,354,346,352,356,347,354,353,350,357,348,352,359,349,354,354,352,359,353,354,360,352,354,357,354,361,355,354,363,355,358,363,356,363,357,355,366,359,359,366,359,363,361,358,368,363,360,368,361,364,367,361,370,365,363,371,366,368,371,364,372,368,365,373,370,371,374,367,374,372,368,377,374,371,378,370,378,378,371,380,376,373,381,375,381,384,374,383,381,377,385,381,382,387,378,384,386,380,387,384,383,390,382,387,391,383,389,388,386,393,386,389,396,387,392,391,391,397,389,391,399,391,396,397,394,400,394,

End

 

As you can see

 

1) A command start comes from the serial port likeStart the the communication starts.

2) End command comes and Serial port is closed.

3)Data values are saved as .csv file in a fixed location.

4) Plot is made

 

In the examples you mentioned there was a example of Break Events.I tried that but i am not able to detect Break.

Which char is recognized as Serial-Break and Serial _TermChar.

 

Thanx and regards

0 Kudos
Message 6 of 7
(5,684 Views)
Solution
Accepted by topic author dakudiv
The example "Detect Break Event" does not apply in your case. Is your instrument causing a break or are you sure a break is actually occuring? Doubtful. In your case you need a loop around the VISA Read. You need to keep reading until you see the characters "End". Use a shift register to append the characters you receive to a string buffer, and then you can parse the string to get the numbers. You should probably also have a timeout to break out of the loop in case the "End" characters are not seen by the VISA Read. See attached example (LV 8.0) for one possibility.
Message 7 of 7
(5,667 Views)