03-25-2014 06:19 PM
Hey guys, I met a problem in using VISA serial port communication module. I use arduino board to simply generate a number 350:
int value=350;
void setup(){
Serial.begin(9600);
}
void loop(){
Serial.println(value);
delay(250);
}
If you can watch the video, you can find that if I highlight execution and run the system, labview can receive data correctly. But if I don't highlight exection, labview goes wrong, sometimes it receives 350, sometimes it receives 50, sometimes it cannot receive anything.
And sometimes an overrun error occurred.
Could you please help me check where I made mistakes?
03-25-2014 06:49 PM
03-26-2014 01:44 PM
Hey Dennis, thank you for you reply!
You mean I should add a termination character in the arduino code, and deal with that character in the labview?
And I can't exactly understand what does "Request some high byte count. Before the loop starts, do a read and discard." mean. Can you figure it out?
03-26-2014 02:01 PM
03-26-2014 03:15 PM
The arduino Serial.println() function is automatically followed by a carriage return character (ASCII 13, or '\r') and a newline character (ASCII 10, or '\n'), in this case, how can I setup in the labview?
I know the problem is the termination character and the while loop, but I don't know how to fix it
03-26-2014 04:55 PM
03-26-2014 06:32 PM
OK I'll try this method! Thank you very much!
And a little confusing, if read data outside the loop, how can labview continuously collect data?
03-26-2014 07:02 PM
03-29-2014 04:12 PM
Oh! It works now!! Thank you very much Dennis!
And a small question, here I use both "waveform graph" and "waveform chart", the chart works well, but there's nothing displayed on the "waveform graph", and I notice that the time(X-axis) doesn't change while running the system, can you tell me why?
03-29-2014 04:28 PM
A graph takes an array of data and plots it all at once. A chart has an internal buffer which accumulates the data fed to it one point at a time. Your graph probalby has one point but you may not see it unless you change the plot style to one which will make a single point visible. If you want to use a graph you will need to accumulate the points in an array, probably via a shift register of autoindexing.
You have X-axis autoscaling turned off on the graph. The first point is at x=0, which is off scale.
Lynn