Digital Oscilloscope / Logic Analyzer Program for your PC.
5 input channels.
100us/div to 100ms/div
plus x10 zoom on single sweep giving 10us/div.
Four trigger modes.
Trigger on change of state of any input,
Trigger of change of channel 1 input.
Store captured waveforms.
Print captured waveforms.
No hardware to make it run.
Photo: A captured waveform showing Clock,
Data and Enable signals for programming an
LMX2325 synthesizer I.C. on Channel 1, 2 & 3.
Download Digital CRO software here. Digcro2k.zip (85,225 bytes).
1. DESCRIPTION OF
The program turns your Personal
Computer (PC) into a 5-channel digital oscilloscope, or perhaps more accurately,
a 5-channel logic analyzer. No external hardware is needed, although it is
recommended that some optional input protection be added to prevent any
excessive voltages reaching the PC circuits. (See section 2b.Connecting the
The program is a development from earlier programs “digcro.exe” and “digcro2.exe” which had much slower sweep speeds.
*Download digcro.exe. digcro.exe (8,450 bytes). This samples inputs once, draws the traces, then repeats.
*Download digcro2.exe. digcro2.exe (9,442 bytes). This does all the input samples, then draws the whole trace.
*Note: These programs require 'brun45.exe' from the '.zip' file above.
An assembly language subroutine is used in this program for sampling the 5 inputs of the parallel printer port. This increases the sampling speed by a factor of about 50 times. The main program is written in QuickBasic, and provides a full-screen display.
The original purpose was to de-bug a software program for programming a serial EEPROM to get the timing of the data and clock signals working correctly, and no logic analyzer was available.
The 5 signal traces are drawn across the screen each with a horizontal resolution of 640 line sections. The 5 channels appear in order with channel 1 at the top of the screen and channel 5 at the bottom.
The screen is divided into 10 horizontal divisions, and the sweep speeds available range from 100us to 100ms/division. In single sweep modes, a zoom mode is available giving a “times 10” increase in speed i.e. 100us/div can be expanded to 10us/div. Simply press function keys F1 to F10 to zoom-in on a particular part of the screen, e.g. F1 for the first section.
Four different triggering modes are available by pressing the appropriate keys 1 to 4.
1) Free run. The horizontal sweep continues until the Space key is pressed.
2) Single sweep. Pressing the “2” key starts the sweep.
3) Trigger on any change of the logic state of any input.
4) Trigger on a change of state of channel 1.
Modes 2, 3 and 4 do a single sweep. Press the spacebar for another sweep.
The sweep speed may be changed by pressing “5” from the
main menu. When a choice is made the two timebase calibration numbers (see
section 3) are printed on the screen in decimal.
Store and Print captured waveforms.
Pressing F11 saves the waveform on the screen to a file ‘save1.txt’.
If this file is to be saved permanently, it should be re-named outside the Digcro2k program. Pressing F11 again will overwrite the old file.
To view a stored waveform run ‘Crodemo.exe’. The default filename is ‘save1.txt’. There is provision for entering another filename from the keyboard.
The example files ‘rword.txt’ and ‘nword.txt’ provided are actual captured waveforms for programming an LMX2325 synthesizer I.C. to 1340MHz. A 1ms/div. timebase was used.
To print a stored waveform run
‘Croprint.exe’. If your printer
uses the same parallel port as the one you are sampling, it will be necessary to
plug in the printer. The default filename is ‘save1.txt’. There is provision
for entering another filename from the keyboard. Standard keyboard characters
are used so that any printer should work, producing a printout to fit on an A4
Unzip the “digcro2k.zip” file giving the following files:
and 8 calibration files
time40.txt, time66.txt, time75.txt, time100.txt, time133.txt, time166.txt, time200.txt and time466.txt.
and sample captured waveforms save1.txt, nword.txt, rword.txt crocal.txt and testsig.txt.
Place all the files in the same directory. Since there are three “.exe” files, the use of the common brun45.exe saves disk space. A Windows shortcut from the desktop can then be made, e.g. to Digcro2k.exe.
Run digcro2k.exe, and the first time it will ask you to select the Central Processor Unit (CPU) speed of your PC. Choose the nearest speed. For example, for 166MHz, the file “time166.txt” will be renamed “default.txt” and this file is used to calibrate the horizontal timebase speed. This sets the time/division across the screen. The other “.txt “ files are not used, and the original ‘default.txt’ file is re-named ‘defltold.txt’..
If your CPU speed is not listed,
you can do your own “custom” calibration by editing the 112- byte
“default.txt” file. (See Timebase Calibration).
b. Connecting the inputs.
I have done much testing on 5-volt logic circuits with no interface circuitry, i.e. by connecting the test wires straight into the parallel port.
Note: However, I take
no responsibility if you damage your PC parallel port, so for general use,
especially if there are voltages above 5-volts, (such as static electricity), a
protection interface circuit is recommended. The circuit below is suitable for
most applications. The circuit is repeated for the other 4 channels.
The channels in order as they appear on the screen (top to bottom) are as follows:
Channel 1 - Pin 15 Port address 379h bit 3.
“ 2 - 13 “ 4.
“ 3 - 12 “ 5.
“ 4 - 10 “ 6.
“ 5 - 11 “ 7.
Most PC’s that I have come across use address 378h(hex) for the parallel port. The port status register for the input lines has an address of 379h. If your parallel port address is different, e.g. 278h, I can email you an “.exe’ file to suit.
Another method of protecting the PC inputs could be to use a hex-buffer IC such as a CD4010 or an MC14050B, with one buffer for each input. The 5-volt supply for the IC could come from any one of the data output pins of the parallel port (pins 2 to 9) which are brought to a logic high by the program.
This is done by editing the calibration file using a text editor such as Windows Notepad, or from a DOS prompt using “edit default.txt” for example. I did consider using a software routine to measure the speed of the PC using the system timer function. This would get rid of the need for the calibration files, but the timer function gave variable results, and the user would not have the control that the “.txt” files provide.
The calibration file must be in the following format e.g. for time75.txt:
One pair of HEX numbers is required for each timebase, with the most significant first. Each pair represents a 16-bit HEX number e.g. for 100ms the number is CCC8 which is 52424 in decimal. A 16-bit register loads this number and decrements it to zero in a delay loop between each sample of the signal inputs. The larger the number, the longer is the delay between samples.
&H00,&H00 100us/div. calibration number.
&H00,&H2B 200us “ “
&H00,&HD5 500us “ “
&H01,&HD8 1ms “ “
&H04,&H00 2ms “ “
&H0A,&H00 5ms “ “
&H15,&H00 10ms “ “
&H2B,&H00 20ms “ “
&H6B,&H00 50ms “ “
&HCC,&HC8 100ms “ “
If the number is 0000h, then there is no added delay between samples, and the PC is going at maximum speed, and the slower computers may not reach 100us/div. If the number is FFFFh, then the maximum delay is used between samples, and the faster PC’s may not be able to go as slow as 100ms/div.
I used the simple interface circuit (below) and a signal generator with an accurate frequency output. Set the output level to drive the transistor into conduction on the positive signal peaks, and vary the frequency to a convenient value e.g. 1KHz for 1ms/division. The pull-up resistor R2 may be connected to any of the data output pins (pins 2 to 9) which are brought to a logic high by the program. Any channel may be used for this purpose because they are all sampled at the same time, and have the same timebase.
The sample waveform ‘testsig.txt’ is a typical waveform that will appear. Adjust the number in the ‘default.txt’ calibration file, save the file, and capture the waveform again until the timing is correct, such as on the example file ‘crocal.txt’. This can be a slow trial-and-error process, but is worth the effort.
For anyone interested, here is a listing of the Assembler code used in Digcro2k.exe:
;This file can make a .com file okay.
;Use "tasm cro1.asm" to make .obj file.
;Use "tlink /t cro1.obj" to make .com file.
;Use "qbasic /run com2bas"," cro1", "Y" to make .BAS file.
;Samples parallel port inputs 660 times to suit QB45 screen line draw.
;----------------------------- Definitions Section
.model small ;make this a COM file
X_cap equ 0h
delay dw 2 ;delay (2 bytes)
;----------------------------- Code Section
jmp Codestart ;Jump over data declarations
strcap dw ?
mov bp, sp
mov bx, [bp+06] ;get address of string passed from Qbasic.
;It appears at [bp+6] on stack.
mov si, [bx] ;put it into Source Index register.
mov bx, X_cap
mov delay, 1234h ;Poke in a different no. here as required.
mov ax, delay
cmp ax, 0000h
mov dx, 0379h ;Put address of "printer status" into dx
in al, dx ;Read port, put result in al.
mov [si+bx], al ;Return printer status to string.
cmp bx, 0294h ;loops 294 (660) times.
jmp term ;go to terminate string with CR/LF.
mov dx, 0379h ;this loop has delay between samples.
in al, dx
mov [si+bx], al
mov cx, delay
cmp cx, 0000h
cmp bx, 0294h
mov al, 0dh
mov [si+bx], al ;terminate as a string.
mov al, 0ah
mov [si+bx], al
mov si, [strcap] ;put address of captured string into Source Index.
This is how the Assembler code appears in the Basic program:
Kevin Bond 27/10/’2000
For any bugs or improvement suggestions