LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Output a 1MHz squarewave through serial port

Is it possible to program using labview to output a 1MHz squareware out from serial port of PC?
0 Kudos
Message 1 of 3
(3,770 Views)
jackolim wrote:
> Is it possible to program using labview to output a 1MHz squareware
> out from serial port of PC?

As I recall, if you continuously transmit the character 'U' with 8 data
bits, no parity and 1 stop bit, TxD will generate a square wave at the
baud rate frequency. If you can set your baud rate to 1 Mhz, more power
to you. Unfortunately, I know that my reference on this subject is on a
slip of paper somewhere in a box full of slips of papers. Many times,
the baud rate generator used in serial ports is only approximate in
frequency; this must be taken into acount if you have a more exacting
application.
0 Kudos
Message 2 of 3
(3,770 Views)
Hello,

While this may be possible, it isn't recommended. The serial port on your computer has a UART with a clock that will clock out whatever byte LabVIEW writes to it one bit at a time along with start bits, stop bits, and parity bits at the baud rate that you specify. LabVIEW can certainly write a character to the UART over and over again, but due to those framing bits (stop, start, parity) you are probably not going to be able to get a very normal square wave out of the port.

To do any sort of serial communication, just use the shipping example LabVIEW <-> Serial.vi that came with LabVIEW. You can experiment with writing different characters to the UART and see how the data comes out the port (pin 3 on a DB9 connector) with a scope. As far as the seria
l framing information, you can check this site for more information:

http://www.lvr.com/serport.htm

Also, the UART was not designed to source much current, so be careful and check the specs on the chip that you have in your computer before doing anything with this square wave.

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(3,770 Views)