LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Baud Rate

Hello,

We are going to communicate with a serial device. The nominal Baud Rate will be 2400, but because of the hardware, (on-board clock generation), this can vary by up to 10% depending on the unit. - But each individual unit will be stable.

On power-up, the unit will transmit a "u" (Hex 55).

Is there a way of getting LabView (2012) to capture this and set the Baud Rate to match automatically?

A VISA configuration setting perhaps?

One solution is to run through the range of Baud Rates until we get a valid response, but this may well be quite time consuming, and may involve cycling the unit power, as well as opening/closing/flushing the COM port.

Any pointers are welcome.

Thank you, Roland

0 Kudos
Message 1 of 4
(1,495 Views)

I'm not sure about with a serial port being able to figure that out.  But maybe you could use a counter to measure the pulse width and calculate the baude rate from that.


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 2 of 4
(1,481 Views)

Hi Roland,

 

this is what NI recommends on baud rate tolerances. Other sources such as Wikipedia recommend using a crystal oszillator to set the baud rate…

 

As most COM ports will use the crystal oszillator I think they are using quite fixed baud rates following the standard ones described at Wikipedia. When your devices have such big tolerances you are probably lost! Can't you improve the hardware to follow "common sense"?

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 3 of 4
(1,475 Views)

Thanks for the responses.

Unfortunately, the hardware is a customer unit, and of a fixed design, with many units already "out in the field".

Therefore we cannot get a "better quality" Baud Rate.

The other thing is that the only equipment is the serial port from a PC, so no oscilloscope to view the actual signal.

 

Fortunately, the communication will only involve reading one number from the unit, and writing a number back.

(Once for each unit.)

 

I think we will have to go for a "trial and error" routine, expanding from the nominal Baud Rate, until the response is the valid character.

The only question is what response will we get from the COM port if the Baud Rate is wrong?

A time-out, invalid character, parity error, nothing?

We will only find out when we get the hardware and try.

 

Thanks again.

Roland Smiley Happy

 

0 Kudos
Message 4 of 4
(1,419 Views)