02-28-2011 09:29 AM - edited 02-28-2011 09:33 AM
Hello, all,
I send the data from AVR MCU to PC via serial interface, 16bytes each time at 50ms interval, if i donot use queue, the data readed from VISA is same as sended. But the read and processing in turn within a while loop is not time efficiently as multi-loop with queue.
I have a byte(0x55) as the first byte of the data transmited, with multi-loop with queue, but now the position of 0x55 is changed all the time, and more likely present at the 8th byte of the data.
Thanks for all help.
Ted
Solved! Go to Solution.
02-28-2011 09:33 AM
02-28-2011 09:38 AM
Ted,
i reordered the elements in the writing loop using the clean up diagram tool and made a screenshot:
Maybe you can explain me the sense of the loop's content.
thanks,
Norbert
02-28-2011 09:52 AM
And to add some important information:
You implemented an endless loop by connecting the FALSE constant to the loop condition terminal. This is very bad! You have to change it.
hope this helps,
Norbert
02-28-2011 11:36 AM - edited 02-28-2011 11:43 AM
Many thanks to Norbert and others,
The data received with VISA read is unstable even no connection to other part, as the screenshot displayed. If the Received Data Buffer connect to following part, the result is the same.
I wonder why the received data can be influnced by queue application.
Attaced is another vi file with no queue applied, it has no problem with VISA read, but there is only one while loop.
I am a new user for LabVIEW, but have take much time in LabVIEW, also thanks for your suggestion about the stop condion setting of while loop, all this is valueable.
With best wishes,
Ted
03-01-2011 01:46 AM - edited 03-01-2011 01:54 AM
Hi Ted,
you're kidding, right?
Ever heard of using left-to-right-wiring?
Ever heard of using subVIs to bundle common tasks?
More specific questions:
Why do you do the data processing in each iteration instead of only for new data? It's just a matter of size of the case structure
The string parsing could be made more compact using a single ScanFromString... The same applies for the string formatting for file writing when using FormatIntoString!
03-01-2011 02:06 AM
@houde_dai wrote:
[...]The data received with VISA read is unstable even no connection to other part, as the screenshot displayed.[...]
With best wishes,
Ted
Ted,
what do you understand with "unstable"? And i saw that in your single loop VI, you are always flushing the buffer after each read, which you do not in the multiple loop VI. Maybe this is causing the issue.
Nevertheless, IF it is the flushing, the root cause is not the VI, but your connection (or the counterpart of your program). Since VISA Read does already remove the read amount of data from the buffer, the data has to be resent/captured again in the buffer.....
hope this helps,
Norbert
03-01-2011 03:28 AM
Dear GerdW,
Thanks for your replay.
I am serious for the questions. Now I have 6 channels to process at the same time, and with 50ms interval every time. And I will carry out with sub VI, or case loop wiht these 6 channels in turn.
ScanFromString may be useful, I will try.
Because I just beginn with LabVIEW, and so grateful to get the suggestions from all of you.
The reason why i donot do the data processing in each iteration instead of only for new data, because I donnot know when get the new data. Now I flush the I/O buffer after each reading, and I think the next reading is new, I donnot know whether it is ok. But the data obtain is in order now.
Thanks to all!
Ted