Use a PC to record four-channel waveforms

-May 25, 2000

This design idea is a sequel to a previous one, "Use a printer port to record digital waveforms," EDN, June 18, 1998, pg 136. Both ideas are similar: Use the PC's printer port to sample waveforms, and use the PC's memory to store data. The technique presented here expands the capability to four channels. The advantage is that you can see the relationships of the waveforms in the four channels. Figure 1 depicts the sampling circuit. It uses printer-port pins ACK, BUSY, PE, and SLCT to record signals. The 74LS04 is a buffer between the sampled signals and the printer port. Listing 1 is the sampling program, written in assembly language. Because there are four channels, every sample needs 4 bits (one nibble) to record. One byte can store two samples: odd and even samples. To accurately record signals, the sampling program needs exclusive access to the CPU.

Execution of the program must take place in pure MS-DOS mode, and not in a Windows multitasking environment. Second, it does not allow interrupts to occur during sampling. You must thus mask interrupts during the sampling procedure. Moreover, you need to equalize the odd and even sampling periods. Because the even sampling period is shorter then the odd one, the routine adds three nonoperation (NOP) instructions in the even sampling period. When the sampled data attains approximately 60 kbytes, the program restores the interrupt-mask register and generates a file named samsig.dat. Listing 2 is a QBasic program for displaying the recorded waveforms. The program reads and then displays the samsig.dat file. Figure 2 provides an example, a recording of the command and data signals from an Analog Devices AD7896 A/D converter. You can increase the sampling period by inserting some NOP instructions in the sampling routine. Click here for Listing 1; click here for Listing 2. (DI #2536)

Loading comments...

Write a Comment

To comment please Log In