LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

writing a serial string to ascii file

Lynn,
Thanks for your help and I apologize for not getting this posted sooner. Here is the program I was referring to. Any assistance would be greatly appreciated.
0 Kudos
Message 11 of 20
(1,132 Views)
Oops, password protected, here's one that's not. Sorry
0 Kudos
Message 12 of 20
(1,131 Views)
I tried to open your vi to help you but the block diagram is password protected. Also, some sub-vi's and controls are missing. Please unprotect the block diagram, and zip all the vi's and controls into one file, then repost the zip file. Also, explain a little more about capturing a string when the channel changes. Where does the string come from? Maybe put some comments on your block diagram to explain what you are trying to do and/or what problem you are having. I will try to help.
- tbob

Inventor of the WORM Global
0 Kudos
Message 13 of 20
(1,231 Views)
What string are you trying to read? Where is it coming from? Please zip all sub-vi's and controls and re-post.
- tbob

Inventor of the WORM Global
0 Kudos
Message 14 of 20
(1,126 Views)
Sorry. Let's try this. My apologies
0 Kudos
Message 15 of 20
(1,122 Views)
Ther is a string coming from an instrument on our roof. It sends the temperature, relative humidity, and pressure in a string. This channel is read for about 5 to 10 seconds and then the channel changes and wind speed and velocity are read. A wireless device is connected and the strings transmitted to the computer.
0 Kudos
Message 16 of 20
(1,122 Views)
I really hate to say this but your block diagram is password protected again. Ooops one more time :). Actually, you might not need to post it if the following helps. Your wireless device that transmits the string must have some driver or dll that allows the computer to access the device. You need to call this dll or whatever function that returns the string from the wireless device. Does the wireless receiver connect to the serial port? If so, then you can perform a serial read to get the string. See help on serial read function. If the device connects to USB, there must be a dll to support reading the string from the device. You have to call that dll function from labview using the Call Library function. This is getting into somewhat advanced topics, so lets take it one step at a time. Tell me how the device communicates with the PC. Once we can read the string, we can open a file and write to it, then close the file. I will be out for the rest of the day, but I will get back with you tomorrow. If in a hurry, maybe someone else can respond today.
- tbob

Inventor of the WORM Global
Message 17 of 20
(1,115 Views)
TBOB sorry for the delay I was trying to use some of the things that have been suggested. I've also attached the "non" passworded version and all sub VIs. I don't know why I am having so much trouble with this read/write thing. The wireless device talks to the computer through a receiver that is attached to the serial port of the computer. I read one channel for about 600 seconds and the other for only about 10 seconds. There are numerous samples to be read and written in the longer read of course and maybe two in the other.

Any Help would be greatly appreciated
0 Kudos
Message 18 of 20
(1,100 Views)
See attached vi. It contains code on how to write your data to a file. I put comments in a red text block. Had to change some things like making loops stop after one iteration because I don't have anything on my serial port. You can change them back or just copy the added code for file writing into your existing vi. Basically what I did was to open a file, convert the retrieved data from a number into a string, concatenated the data into a single string with commas separating the data and an end of line constant to terminate the string, then write the line to a file. I did the same for the next case which collected wind data. When the stop button is pushed, the file is closed. If you look at the file that is generated, you will see something like:
12.4, 45, 56.23 (this is pressure, temperature, humidity)
34, 45 (this is wind speed and direction)
The last line may be repeated 5 times with different data because your code does 5 loops. Anyway, I hope you get the idea on how to write sequential data to a file. You can add labels and headers by concatenating labels before the data, and writing a header to the file before the loop begins.
- tbob

Inventor of the WORM Global
Message 19 of 20
(1,096 Views)
tbob,
Fantastic!! I will give this a look this morning and try to put it all together and let you know how it is going and working. I appreciate your persistence and patience!
0 Kudos
Message 20 of 20
(1,078 Views)