Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication using Ti module MSP430 eZ430 RF2500

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. 

0 Kudos
Message 1 of 9
(5,001 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 9
(4,987 Views)

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?

 

0 Kudos
Message 3 of 9
(4,981 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 9
(4,974 Views)

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.

0 Kudos
Message 5 of 9
(4,955 Views)

@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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 9
(4,951 Views)

It sends atleast one string per second. This error occurs when I start the VI. 

0 Kudos
Message 7 of 9
(4,945 Views)

Stupid question: Is the microcontroller on and sending data before you start the VI?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(4,930 Views)
Yep! I will increase the timeout and check again.
0 Kudos
Message 9 of 9
(4,927 Views)