LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving data from my instrument (RS232)

I am trying to make communication between anemometer and desktop through RS232(9pin).  I found an example VI (advanced serial write and read.vi) in my LabView7.1. I am able to communicate and see data from the instrument. How can I save the data into text file? How can I put sampling time column on each data point? Thank you
0 Kudos
Message 1 of 13
(3,799 Views)
Well, here is a simple vi that should do the job ...

Steven

0 Kudos
Message 2 of 13
(3,778 Views)
Hi Steven,

I appreciate your help.
when I tried to run your serial vi file to communicate with anemometer,
it asks me "choose file to write".
I guess this is where I want to put my output file.
I tried to make text file and then reran your vi.
but it kept asking me to choose file to write.
Can you help me how I can solve this issue?

again, I really appreciate your help.
Lee
0 Kudos
Message 3 of 13
(3,753 Views)
Hi,

The way it is programmed now you should put the name of the file in the path control before running the vi. Then it should run fine.

Another method would be to first open/create the file before you start the while loop, use 'write file' in the while loop and 'close file' after finishing.

Steven


0 Kudos
Message 4 of 13
(3,745 Views)
Hi,

now I am able to save output file from my instrument.
I still have some questions. It looks like that it creates an output file with two columns (elaspse time and signal).
the data were collected ~every 0.062 second with one data point.
the original output from the instrument has 5 columns with 4 hz sampling frequency. there are 5 numbers every 0.25 second sampling period.
How can I create a current time column along with every sampling data point?

Thank you very much,
Lee

0 Kudos
Message 5 of 13
(3,741 Views)
Hi,

You will have to give a few more details about your application.

Do you send a command to tell the machine to give the data (like in the example vi), or is the machine continuously sending the data?
What is the data format? How are these 5 number separated? With an eol character?

Steven


0 Kudos
Message 6 of 13
(3,725 Views)
Hi,

The instrument is continuously sending data once a serial cable is connected.
The instrument sends out ASCII Text Serial String (wind speed, direction, elevation, speed of sound, sonic temperature).
each data column is separated by space. the instrument is sending 5 numbers every 0.25 second.
I am trying to understand LabView by reading mannual and example vi.

0 Kudos
Message 7 of 13
(3,719 Views)
Hello Lee,
 
It seems to me that you have recently started programming with LabVIEW. Although it always a good idea to get your hands dirty and start programming straight away, but I think it would be a whole lot more efficient for you, if you go through some training material regarding LabVIEW programming. We have some free training material available on the web which you can quickly refer to and get upto speed on programming in LabVIEW. This way you would not have to rely on others to fix your code Smiley Wink and then soon you will be helping out others Smiley Happy
 
Regards,
Chetan K
AE-NIC
0 Kudos
Message 8 of 13
(3,710 Views)
Hi,

Attached a modified version of the vi.
The number of bytes at the port are read until a given (here 20) number of bytes (change this according to your need).
Then the data at the port is read and converted into an array which is then written to the file.

Steven




0 Kudos
Message 9 of 13
(3,708 Views)
Hi,

I am trying to build my own VI.
My serial VI is able to communicate with an instrument.
It saves data from the instrument to text file.
but, it looks like that there are still problems.
It showed an error message (Error-1073807339, possible reasons: VISA(Hex 0xBFFF0015) Timeout expired before operation).
It reads 5 data points (string) separed by space.
How can I make that the data have five columns and next 5 data points append in the next row?
Attached files are my VI and output text file.

Thank you,
Lee
Download All
0 Kudos
Message 10 of 13
(3,687 Views)