Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Data output via RS 232 serial port

Hi

Is it possible to send a square waveform (digital) from the RS 232 serial port of the PC using labview 8.2?

Thanks

Mal
0 Kudos
Message 1 of 7
(4,476 Views)

Mal,

It could probably be done by using one of the RS232 control lines and using a property node to toggle its value.  The problem will be that the output waveform will not be very accurate and frequency will vary a bunch.  It's probably not the best solution.  Is there a particular reason you want to use the serial port?  Have you considered the parallel port?  It can be controled via NI-VISA as well.

0 Kudos
Message 2 of 7
(4,459 Views)
Hi

Thanks. Yes even the parellel port is also fine. I would appreciate if you can give me an example programme of how to send data through it.

Thanks

Mal
0 Kudos
Message 3 of 7
(4,443 Views)
LabVIEW ships with an example to control the parallel port. Just open up the example finder (Help>>Find Examples...) and search for parallel. You can also use any of the basic serial examples to write to the parallel port with VISA.

Regards

Jon B
0 Kudos
Message 4 of 7
(4,424 Views)

Mal,

You could also output a hex value out of the serial port (0x55).  The binary pattern would be 0101 0101, so it would generate a square wave including start and stop bits (if they are each set to 1).  The frequency will be equal to half the baud rate.  The only problem would be the space between bytes.  All serial drivers behave a little differently.  Depending on the system, drivers, and port, the amount of space between bytes could vary. 

To minimize the amount of space between bytes:

Create an array of U8s with 0x55 as the value.  Use the Byte Array to String vi to send this string of 0x55 data to the VISA vi (the VISA Write only accepts string data, so you must convert it).  This allows you to write multiple 0x55s out of the serial port in a row.

I hope this helps,
Steven T.

0 Kudos
Message 5 of 7
(4,352 Views)
Hi
 
Thanks. Can I use this in the serial port examples in the Labview serial port example folder to send data out from the serial port?
 
Thanks
 
Mal
 
 
 
 
0 Kudos
Message 6 of 7
(4,319 Views)
Sure
The only thing that makes it easier is to right click on the string to send and change the visibility to show /codes
greetings from the Netherlands
0 Kudos
Message 7 of 7
(4,305 Views)