10-24-2009 09:13 PM
The device sends data continuously without you needed to send a command to it?
How often is the data sent? It sounds like it is more frequently than 12 seconds. Put a zero msec wait is definitely wrong because the loop will run nearly infinitely fast. Certainly much faster than the device is sending data.
Does your device send the same number of bytes in each packet of data?
Does your device send the data ending with a termination character?
If either of these two things are true, then you can either request the specific number of bytes, or request a sufficiently large number of bytes with the termination character enabled.
Even though the LabVIEW serial example likes to use the bytes at port property to read data, I don't think I've found a case yet where working with a real world device that it is the proper method to use.
10-24-2009 10:13 PM
you string format looks like this one
with max value of the decimal be 255 ie three bytes.
give the read function. count of the bytes & remove property node and delay.
I dont know if this works or not lets give it a try.
Include delay
if micro controller send these strings with a definite delay.
it will be better if microcontroller programmed so that there is some delay between each data sample string transmission.
Regaurds
A.chaitanya
10-25-2009 06:52 AM - edited 10-25-2009 06:54 AM
If Ravens conditions are true for you then I have this VI for you that justifies both condions. I am reading 1 byte at a time and termination character is A. The case struture part is for writing on the port on different conditions to take action accordingly. I am still in the process of completing it. Hope it helps.
I also want all of you to tell me that how I can make my block diagram more professional. Any mistakes in it so far or any advice. Thanks.
10-25-2009 08:29 PM
Here are some basic tips for your VI.
10-26-2009 04:46 AM - edited 10-26-2009 04:56 AM
10-26-2009 08:56 AM
10-26-2009 12:59 PM
10-26-2009 01:17 PM
10-26-2009 03:23 PM - edited 10-26-2009 03:27 PM
10-26-2009 04:01 PM
Here is a little bit more of a clean so that the sequence structure can be removed.
Wire up the error wires for the file functions. Put a probe or indicator on them to see if you are getting any errors.
I suspect that it may have something to do with opening the file with the "create" option. Also you don't have a file path wired up to it. So what will happen is that it will pop up a dialog box every iteration asking your for a file name. And if that file exists (which it will every time after the first iteration), it will then ask if you want to replace it. And if you say yes, it will then overwrite the data with the new data.
I would use a file path constant or control. Use the Create or Open option. And if you want to have a file where the data continually appends to the end, the use the Set File position and set it to the end after every open.
Now what you may want to do since this loop may run fairly quickly, all based on how fast the device sends data, you may want to open the file before the loop, and close it after the loop.
And to get the file part working to your satisfaction, particularly since there is a lot of string formatting going on, break out the file writing part to a separate VI without the serial stuff. Put it in a loop with a wait statement, and turn the data coming from the serial part into controls you modify. Now you can debug and get the file working right. Once you have that, then add it back into the serial part.