Parallel Port experiments
Jim's webpage http://www.jimspage.co.nz/intro.html describes a smart & simple interfacing method for getting flightsim data via RS232 com port to another PC, where the data can be read with GWbasic and send to the parallel port. I have tried this interface and it works very well. GWbasic commands for driving the parallel port are very simple: " out 888, xxx ", where 888 (378 hex) is the address of the parallel port data pins, and xxx is a number from 0 to 255 that will drive the data pins #2 - #9. 000 means all pins are low, and 255 means all pins are high. Anything in between will set the bits according the binary code.
GWbasic can be run from a DOS box under Win98 and WinMe. I did not succeed in getting it to work under XP. For best results, you better run GWbasic directly from the command prompt. To see what is happening on the parallel port, you can make a simple circuit like shown below, that should give you an visual indication when one of the parallel port data pins is high.
The parallel port can be used for driving relays, but you can also make it into a cheap Digital - Analog Converter (DAC), by letting the data pins drive an R-2R resistor network. For more accuracy, it is better to use a buffer in between the data pins and the resistor network.
For two DAC outputs from the same parallel port, you can drive two 8-bit latch IC's, where the data is latched into the buffer by a control signal from one of the control pins. A possible schematic is shown below. For IC spec, see here
The software writes data to the port, then control #14 (CK DAC1) low - high - low, the data is latched in DAC1 and new DAC1 voltage is at output 1. Then the software writes data for DAC2 to the port, then controls #17 (CK DAC2) low-high-low, the data is latched in DAC2 and new DAC2 voltage is at output 2. In this way, two independent DAC voltages can be achieved. Totally four DAC's could be used, each one's clock controlled by one of the 4 control pins.
I build this circuit and wrote a program that runs a continuous loop, sending 0, 1, 2, ..255 for DAC1 and 255, 254, 253,...0 for DAC2. Both DAC's are clocked in each loop cycle.
10 OUT 888,0 : REM sets all data outputs low
Note: If you want to run this program, copy the text to notepad. then use
"save as" and select "all files" and type a name like DACTEST.BAS This file
can be loaded into GWbasic and run in a DOS window.
This experiment shows that using parallel port for driving multiple DAC's is possible. Speed should not be a problem. I ran my program from a Pentium1 (200MHz) PC.