In cases where low frequencies are acceptable, a user-defined analog waveform can be generated using the design presented. The circuit employs a low-power 12-bit digital-toanalog converter (DAC) connected to the parallel printer port of a personal computer. Because of the low operating current of the DAC (0.25 mA), the supply voltage can be provided by one output buffer of the parallel port. Thus, the only connection to this circuit is done through the computer’s parallel port. If the surface-mount version of the DAC is used, the whole circuit can fit inside a DB25-pin connector’s plastic cover. This can be plugged directly into the parallel printer port of the PC.
The Maxim MAX530 is a low-power, 12-bit DAC that can be powered from a single +5-V supply. This device has an internal reference circuit and an output buffer amplifier. The output voltage range used in this design is 0 V to +2.048 V. To protect against short-circuit currents at the output, a 510-Ω series resistor (R1) was added. The data comes to the DAC in nibble format using Data-0 to Data-3 outputs of the parallel port. The supply voltage comes from Data-4 output, and the control signals from Data-5 to Data-7. The ground is connected to pins 18 to 25 of the parallel port.
The 12 bits of data are divided in three 4-bit nibbles that are written sequentially to the DAC using the control signals —WR, A0, and A1. To set the output voltage of the DAC, the low nibble is written first on the rising edge of —WR with A0=Low and A1=High. The middle nibble is written second with A0=High and A1=Low, and the high nibble is written last with A0=High and A1=High, which also updates the DAC output level.
The program code in C++ sets the parallel-port address to 378-hex, corresponding to LPT1 at most computers. Then, if the option “Create a new stimulus file” is selected, the program prompts the user to enter the desired voltage output levels and the timing values. The voltage-level values need to be expressed in millivolts (without typing “mV”), and the range is 0 to 2000 corresponding to a 0- to 2-V output signal. The time values are normalized and need to be calibrated as a function of the speed of the computer.
To calibrate, the user needs to program a squarewave signal, then measure the period with a frequency counter or an oscilloscope, and calculate the time interval corresponding to one count. The program connects the voltage/time entered points with straight lines. The slopes of the connecting lines are equal to (V(n+1) − V(n))/(t(n+1) − t(n)), where V(n+1) and V(n) are two consecutive user-entered voltage levels, and t(n+1) and t(n) are the corresponding timing values. The calculated points then are formatted as 8-bit numbers with bit-0 to bit-3 containing one nibble of the 12-bit DAC input value, and the other 4 bits (bit-3 to bit-7) containing control signals for the DAC.
The sequence of 8-bit numbers is stored in a file named “stim_data.dat”. When starting the program, the user can opt to use the existing file or create a new one. Next, the file is continuously read and the sequence of 8-bit numbers containing data and control signals is sent to the LPT1 parallel port. The maximum number of voltage/time points that a user can enter to create an analog-signal stimulus is determined only by the computer’s available memory for the stim_data.dat file. The voltage output of the DAC follows the sequence of levels stored in the file. The command to stop the waveform generation is <ctrl><c>.
This design is a simple, low-cost way to generate low frequency signals with nonstandard waveforms. The files containing stimulus waveforms can be stored in the computer under different names and can be reused by renaming them “stim_data.dat”.