LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I send pulse train through RS-232

I've purchased an RF transmitter and receiver with the RS-232 interface to control a remote control device from my laptop. I need to send PWM (pulse width modulated signals) to the reciver to control some servos. All examples I have seen only involve DIO cards. Is it possible for LabVIEW to send a pulse train through RS-232?
0 Kudos
Message 1 of 2
(2,878 Views)
Hmmm - possible with exceptions. A PWM waveform can be generated using a UART by transmitting the same character over and ensuring that it is sustained at 100% (no gaps between characters). This is VERY dependant on the type of hardware installed in the system, the baudrate you're using, and the speed of the system.

The general principle is to select chracters that when placed back-to-back, generates the waveform you're looking for. Setting the COM port to 8N1, you get a start bit and a stop bit, and you control the bits in between. So, if you want to transmit a 10% PWM, you transmit 0x00, and a 90% PWM would be transmitting 0xFF (remember, RS-232 data is "inverted" with negative voltage being a mark, positive being a space).

To go inbetween in s
teps of 10%, you could write 0x80, 0xC0, 0xD0, 0xF0, 0xF8, 0xFC, 0xFD, and 0xFF. UART data frames are start bit ('0'), D0-D7, stop bit ('1').

I routinely use the UART to generate a square wave by writting 0x55 over and over - very handy.

Hopefully you have a scope as that will greatly help in setting this up.
0 Kudos
Message 2 of 2
(2,878 Views)