LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

More Efficient VI than Serial Clear?

 When trying to write three characters to the serial port, I found that the serial port needs to be cleared between each character writing. But, the VI serial clear takes noticeably more time than without serial clear. Is there a more effiecient VISA command than serial clear VI?

 

 writeChar.jpg

 

I would like to run this in a 15 milisecond loop on a PC using LabVIEW 8.5.1.

0 Kudos
Message 1 of 4
(3,213 Views)

Why do you think you need to clear the buffer between writes? I've cleared the buffer at the beginning but in all my years of using serial, never had a reason to clear between. You code seems unnecessarily complicated if all you have to do is write 3 bytes. Why do you start with a DBL array. Why don't you just have a U8 array to start and with a Byte Array to string, use a single VISA Write?

 

Why don't you post an actual VI. It's impossible to debug a picture.

Message 2 of 4
(3,201 Views)

I thought I needed to clear the buffer between writes because when I didn't have them in there, the VI would only write the first byte, and with the clear buffer it at least writes all three bytes, although it is slower. I have a different version of the code that you suggested, but it only writes the first byte as well, so I wanted to use the code that worked the most.

The VI in the picture (1st), as well as the simplified code (2nd) is attached.

Download All
0 Kudos
Message 3 of 4
(3,194 Views)

Still way too complicated. If you want to write each and every byte in the array, you just need to do what is shown below.

 

Write Bytes.PNG

Message 4 of 4
(3,191 Views)