LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port init frequency

I currently use LV to dialog with an RS232 device via the serial port.

How often does I have to re-init he serial port?
For the moment, I do it each time I want to send a string to the device.
0 Kudos
Message 1 of 5
(3,080 Views)
Zen writes:

> I currently use LV to dialog with an RS232 device via the serial port.
>
> How often does I have to re-init he serial port?
> For the moment, I do it each time I want to send a string to the device.

In theory: Once. It depends on whether you have an initialisation
phase or want to avoid it. If you don't need high speeds, you can
leave it the way it is.

Johannes Nieß
0 Kudos
Message 2 of 5
(3,080 Views)
Johannes Niess a écrit :

>
> In theory: Once. It depends on whether you have an initialisation
> phase or want to avoid it. If you don't need high speeds, you can
> leave it the way it is.

I send a string everery two seconds, and raed the reponse from the
device. I just don't know if the serial buffer is emptied before
receiving the response string. If not, there might be left old caracters
causing a wrong response string.
0 Kudos
Message 3 of 5
(3,080 Views)
Zen writes:

> Johannes Niess a écrit :
>
> >
> > In theory: Once. It depends on whether you have an initialisation
> > phase or want to avoid it. If you don't need high speeds, you can
> > leave it the way it is.
>
> I send a string everery two seconds, and raed the reponse from the
> device. I just don't know if the serial buffer is emptied before
> receiving the response string. If not, there might be left old caracters
> causing a wrong response string.

You should use VISA and forget about the low level stuff. If you have
non-binary communication (printable characters only, CR/LF) you can
try to read e. g. 1000 chars and VISA returns the string until the
first linefeed. And you get a timeout loop for free 🙂

Joha
nnes Nieß
0 Kudos
Message 4 of 5
(3,080 Views)
perform a "dummy" read of the serial port and throw away the data before
sending the serial command.
that way you know the buffer is empty before you expect data.

Stu

"Zen" wrote in message
news:3A3788B7.17B95C8@lure.u-psud.fr...
>
>
> Johannes Niess a écrit :
>
> >
> > In theory: Once. It depends on whether you have an initialisation
> > phase or want to avoid it. If you don't need high speeds, you can
> > leave it the way it is.
>
> I send a string everery two seconds, and raed the reponse from the
> device. I just don't know if the serial buffer is emptied before
> receiving the response string. If not, there might be left old caracters
> causing a wrong response string.
Stu
0 Kudos
Message 5 of 5
(3,079 Views)