11-05-2008 08:59 AM
I use a VI to sniff an RS232 and I want to log the results to a textfile. The program is built around a while-loop
that constantly reads from the serial port. I've tried defferent variations,but either I overwrite the contents of the
file with every iteration, ending up with a log of only one byte, or I'm asked to make a new file for every iteration.
11-05-2008 09:06 AM
Well, without seeing your code we cannot tell you what's wrong. We can guess, but there's too many possibilities.
You should consider just using a tool that designed to do serial port sniffing, such as PortMon, or other similar utility. Do the Google, and you should come up with a bunch of results. ![]()
11-05-2008 09:17 AM - edited 11-05-2008 09:17 AM
Below is an example of a simple file write. There are numerous methods for writing to a file and you did not mention what functions you are using. If the code below is not what you want, please post what you've written.
11-06-2008 03:52 AM
When inserting the write-object inside the while-loop like that the program will try to create a new file in every iteration.
I try to include my code in my posting, but I can't figure out how it's done. It is attatched.
11-06-2008 04:10 AM
11-06-2008 04:32 AM
11-06-2008 05:06 AM
Should this really be that hard? I can get the data to show in a read buffer (which
obviously flicker away to fast for me to read). All I want to do is log it. This should be
possible if I could just connect the file writing objects properly.
11-06-2008 08:19 AM
It isn't that hard. why don't you try writing something like I posted. Your VI is fatally flawed. You have the write file outside the loop where you will only write one result. And even if you move it inside the loop, you don't have the file path from the File Dialog wired up. Have you looked at any of the shipping examples?
11-06-2008 09:16 AM
I have rewritten it a little, using Set File Position and putting the Write File inside the loop. Now it will only ask for a file name twice. If I enter two different names the first one will be forgotten; no file by that name is created.
The sniffing aspect is also working poorly. This used work, but for some reason it doesn't do that anymore. The return count constantly shows zero and the log files that actually are created are filled with nothing but zeroes.
11-06-2008 09:41 AM