From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-09-2006 09:18 AM
10-09-2006 09:35 AM
10-09-2006 11:14 AM
03-25-2013 02:17 PM
Hi spider_1112002,
I am working with RS232 communication using Labview. I have thermocouple input module connected to the PC through a RS232 serial port. I am using the labview example file Basic serial read and write to communicate to it. I am able to configure the module using the Write string and reading the output from the module in read string.
The output it shows in read string is something like this, A25\r here, A refers to the header, 25 the temperature I am reading and \r the carriage return.
Intend to operate the thermocouple input module in a continuous fashion at different frequency and I would like to get this output (either in the form of string (A25\r) or just the temperature value (25)) in a text file.
I tried using the "write to measurement file" but it doesn't write the value displayed in the read string to the output text file. Also I tried using write to text file option and it writes only one data (such as A25) to my output text file.
Can you help me get over this problem. Appreciate your help.
If I had posted this in an inappropriate section please direct me to the right place.
Thank you,
vzv
03-25-2013 02:17 PM
Hi spider_1112002,
I am working with RS232 communication using Labview. I have thermocouple input module connected to the PC through a RS232 serial port. I am using the labview example file Basic serial read and write to communicate to it. I am able to configure the module using the Write string and reading the output from the module in read string.
The output it shows in read string is something like this, A25\r here, A refers to the header, 25 the temperature I am reading and \r the carriage return.
Intend to operate the thermocouple input module in a continuous fashion at different frequency and I would like to get this output (either in the form of string (A25\r) or just the temperature value (25)) in a text file.
I tried using the "write to measurement file" but it doesn't write the value displayed in the read string to the output text file. Also I tried using write to text file option and it writes only one data (such as A25) to my output text file.
Can you help me get over this problem. Appreciate your help.
If I had posted this in an inappropriate section please direct me to the right place.
Thank you,
vzv
03-25-2013 02:36 PM
That post was from 2006 but you're in the right place. Sounds like your problem is NOT with RS-232 but rather writing data to a file correct? There are many examples that show how to do this: Help > Find Examples... Fundamentals > File I/O
If none of those help you, post your code. This is usually a pretty trivial task but your problem description isn't sufficient to guess what's wrong. Although you may want to make sure you are APPENDING to the file to avoid overwriting it each time you read data.
03-25-2013 03:43 PM - edited 03-25-2013 03:44 PM
Hi NIquist,
Appreciate your reply. I am reading the serial port and yes, my problem is with writing data into a file. The examples files were a little helpful and I have constructed a VI with that and attached with this post. I am reading the port at 500 ms frequency (delay before read) for 5 seconds, for which I expect upto 10 values logged into the file. But I see only one ('A25'). I am operating at room temperature (no fluctuations in temperature), so I am not sure whether this 'A25' is the first or the last read string from the port.
I am using LABVIEW 2012 SP1 (32bit)
Thank you,
vzv
03-25-2013 10:12 PM
You are writing to the file, which if it wasn't opened before, will overwrite the data in the file. Then you set the file position to the beginning, then do nothing after that. Then your VI ends.
You aren't using continuous run are you?
If you rerun the VI, then the whole process starts over, and you still wind up with only one piece of data in the file.
03-26-2013 09:44 AM
I am using continuous run for my work. My intended idea was to select the text file at the beginning of each data collection (create/open existing file) such that the values from the board are stored as a list in a new text file or get appended (if it is an already used text file) during the continuous run.
I don't see a difference when I change the set file position between start/current/end. How do I avoid this overwriting of the data?
Thank you,
vzv
03-26-2013 10:08 AM
@vzv wrote:
I am using continuous run for my work. My intended idea was to select the text file at the beginning of each data collection (create/open existing file) such that the values from the board are stored as a list in a new text file or get appended (if it is an already used text file) during the continuous run.
I don't see a difference when I change the set file position between start/current/end. How do I avoid this overwriting of the data?
Thank you,
vzv
You need to set the file position before writing to the file. This requires opening the file first and also be sure to close it when complete.