Pulse Generator
This software generates a square waves of 18-19200Hz using an RS-232C port.
Although it is possible to generate arbitrary waves through PC's audio output, RS-232C port is better to generate clear digital signals. You can generate a desired pulse by controlling the bit pattern of asynchronous data.
Asynchronous data consists of a start bit, character bits, a parity bit, and stop bit(s). It is transmitted from LSB(D0) to MSB by the negative logic (inverted). To generate a duty 50% pulse, repeat "1-01010101--0" (start-0x55-no parity-1 stop) at the "1/2 baudrate" frequency. In the same way, repeat "1-11110000--0" for "1/10 baudrate" Hz, and repeat "1-11000111-0-00" for "1/6 baudrate" Hz.
_|~|_|~|_|~|_|~|_|~|_ 0x55 _|~~~~~~~~~|_________ 0xF0 _|~~~~~|_____|~~~~~|_____ 0x1CThe sheet below is the audio frequencies that can be generated by USART.
Frequency (Hz)
Baud rate (bps)
Parity bit
Stop bit
Data (hex)
18.3
110
even
2
1C
30
300
none
1
F0
50
300
even
2
1C
60
600
none
1
F0
100
600
even
2
1C
120
1200
none
1
F0
150
300
none
1
55
200
1200
even
2
1C
240
2400
none
1
F0
300
600
none
1
55
400
2400
even
2
1C
480
4800
none
1
F0
600
1200
none
1
55
800
4800
even
2
1C
960
9600
none
1
F0
1200
2400
none
1
55
1440
14400
none
1
F0
1600
9600
even
2
1C
1920
19200
none
1
F0
2400
4800
none
1
55
3200
19200
even
2
1C
3840
38400
none
1
F0
4800
9600
none
1
55
5600
56000
none
1
F0
5760
57600
none
1
F0
6400
38400
even
2
1C
7200
14400
none
1
55
9600
19200
none
1
55
11520
115200
none
1
F0
19200
38400
none
1
55
This software uses these frequencies only, since some USARTs only accept certain frequencies like 600, 2400, 38400, etc. You can use a USB-RS232C converter too.
Execute this program in the Command Prompt window. Use up/down arrow keys to change frequencies. It takes some time to switch between frequencies. Some USARTs fail to generate some baudrates.
C:\tmp\pulgen>pulgen 3 Pulse Generator by Osamu Tamura (freq:arrows, quit:space) 800 Hz 960 Hz 1200 Hz 1440 Hz ...The 3 is the COM port number.
Modify and upgrade the code for your own needs.
Download: pulgen.zip (31KB) (source codes and executables for Windows XP/Vista/7)
8 March 2010 Osamu Tamura