03-08-2016 09:07 PM
Hi, I have a VI that reads MSP430 continuously, stores the string in a table, parses the data depending on a string identifier and then plots in two different charts depending on the identifier.
Using the same TI module, when I use serial communication with other GUI it reads a lot faster than in LabView. But I need a VI in LabView as I have to plot the data and other GUI is just reading it. My point is that TI module is programmed currently and its the LabView that is slowing it down.I am attaching my VI, it would be great if someone could help me out.
P.S : I am new to LabVIew and this is my first VI.
03-09-2016 04:46 AM - edited 03-09-2016 04:47 AM
What exactly is the communication protocol? How are the messages being sent through the serial port? How often is data sent?
At a quick glance, you could probably get rid of the 300ms wait. The VISA Read will limit your loop rate while it waits for data to come in.
Otherwise, here is a quick clean up of your code. You can simplify things a little bit by moving the conversion of value out of the case structure.
03-09-2016 05:35 AM
Microcontroller uses UART communication and sends data at 9600 baud rate. It sends a string with two elements at a time.
I had made the baud rate higher in the VI as I wasn't sure how to make it faster.
Should I also decrease the number of bytes it reads?
03-09-2016 06:11 AM
@ManujaSharma wrote:It sends a string with two elements at a time.
Elaborate more on this. Based on your code, I assume it is Channel,Value\n. Meaning that the first string is the channel, then a comma, then a string for the value, and end with a Line Feed (0xA, \n). If this assumption is correct, then you are fine with the large number of bytes to read since the VISA Read will stop when it sees the Line Feed (called a Termination Character).
@ManujaSharma wrote:I had made the baud rate higher in the VI as I wasn't sure how to make it faster.
No. Baud Rates must match. That is what tells the hardware what clock rate to use.
03-09-2016 08:07 PM
Yes, the format of the input is as you mentioned. Removing the timer does makes it fast. Though at times I am getting an error 1073807339. Even before making the change , at times, I got this error.
03-09-2016 08:27 PM
@ManujaSharma wrote:Though at times I am getting an error 1073807339. Even before making the change , at times, I got this error.
How often does the microcontroller send data? That error implies that no data was sent for 10 seconds (the default timeout).
03-09-2016 08:48 PM
It sends atleast one string per second. This error occurs when I start the VI.
03-10-2016 05:25 AM
Stupid question: Is the microcontroller on and sending data before you start the VI?
03-10-2016 05:41 AM