02-08-2014 05:41 AM
Hello everyone.
I'm trying to figure how I can solve a problem on LabView. I've programmed an Arduino board to read and send an array of data from an accelerometer to the serial port. I want LabView to receive the data and graph it. My problem is that Arduino is sending data continuosly and sometimes LabView can't keep up with the flow and read some values as "0".
Is there a way to wait for the data and solve this problem?
I've attached my current vi.
Thank you very much in advance.
Solved! Go to Solution.
02-08-2014 01:22 PM
Well, LabVIEW can certainly keep up with a 9600 baud serial port.
1. You have the port configured with the default setting: Enable Termination Character = True. You should never use that setting and Bytes at Port at the same time. If a termination character ever occurs in the data, the read will terminate early.
2. How does the Arduino identify the end of one data array (or data point) and the beginning of the next?
3. How many characters are in each data point or array from the Arduino?
Lynn
02-09-2014 04:15 AM - edited 02-09-2014 04:16 AM
Thanks for your answer.
For your questions:
1) Then I'll change it, sorry but I'm a newbie.
2) I've made a for cycle, when the array is filled Arduino send the data to the serial port and then he restarts to collect the data.
3) Each data point has 6 characters and I have 6 values (the 3 axis of the accelerometer and the 3 of the magnetometer).
02-09-2014 09:58 AM
Good. Now a little more detail, please.
3) Are the characters ASCII numerals, binary, or something else? What is the range of all possible characters in the data?
The reason for these questions is to determine whether it is possible to identify the beginning or end of each data cycle.
Lynn
02-09-2014 10:28 AM
Well, they are numerals.
Sorry for not understanding, but what do you mean for the range of all possible characters in the data?
I really appreciate your help.
02-09-2014 01:28 PM
Your device sends the ASCII characters "0" "1" "2" "3" "4" "5" "6" "7" "8" and "9", right? What about "+" "-" or "."? The bytes have decimal values in the range of 43 to 57?
The reason I ask this is that the terminology or language used to describe the characters can be confusing and I am trying to be sure that I understand exactly what your Arduino is sending. The fixes or solutions for your problem depend on knowing those details.
Lynn
02-09-2014 01:43 PM
Yes, the characters are from 0 to 9 and - No "+" or ".". And the bytes have that range.
Once more, thank you very much.
02-09-2014 03:07 PM
@AndreasSchnaas wrote:
Yes, the characters are from 0 to 9 and - No "+" or ".". And the bytes have that range.
Once more, thank you very much.
Since you are sending actual ASCII characters, change your Arduino code to send an End Of Line character (byte value of 10) at the end of each transmission. Your code is already setup to use that. Then you don't need to use the Bytes At Port at all. Just tell the VISA Read to read a huge number of bytes. The read will stop when it finds the termination character (the value of 10). Your code will get a lot easier from there.
02-09-2014 03:16 PM
I was thinking exactly what crossrulz wrote. Try it that way.
Lynn
02-09-2014 04:29 PM
Thanks to both of you for the suggestions. I'll try to take this way.