From: "Saved by Internet Explorer 11"
Subject: LPTScope hardware
Date: Mon, 4 Jul 2016 10:12:08 -0700
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----=_NextPart_000_0000_01D1D5DC.8596A9A0"
X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.17609
This is a multi-part message in MIME format.
------=_NextPart_000_0000_01D1D5DC.8596A9A0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Content-Location: file://C:\Users\R&D 1\Documents\Research\Software\LPTScope hardware.htm
At=20
the beggining: I don't take any responsability if you burn out your PC =
or=20
anything else. I don't even care. You are using this information at =
your own=20
risk.
ADC0820 (TLC0820) is a cheap and fast ADC. I like it! See =
the datasheets.
This=20
oscilloscope uses the SPP or EPP parallel port (LPT1) for reading the =
data from=20
ADC. If your LPT1 is an ECP then the program automatically switches the =
LPT1 in=20
byte mode (normal mode). BUT, not all parallel ports (LPT ports) are=20
bidirectional. "Bidirectional" means, that except outputing data, the =
port can=20
also read the data.
How to determine if your LPT1 port is a =
bidirectional=20
one? Start the LPTscope program and on the program menu select: =
"Bidirectional=20
capabilities testing" then follow the given instructions.
This =
is how=20
the test is performed: =20
1) Program sets pins 2-9 of LPT1 =
port all=20
high (5V). In other words: program puts a 0xFF in the data port of your =
LPT1 at=20
adress 0x378
2) Program then continuosly reads the LPT1 data port =
and tracks=20
if anything changes
3) Your task is to connect any data pin to a =
ground. For=20
example, connecting pin 2(DATA0) to pin 18(GND) would change the read =
value=20
from 255 to 254. You should use a 1kOhm resistor to connect a "high" =
pin to a=20
GND pin
a) If the port is not =
bidirectional (pin 2=20
keeps 5 volts), 1k resistor is big enough to limit the current at 5mA. =
5mA=20
sources from pin2 and sinks on pin18 which is acceptable on all ports =
without=20
damaging it. (1kOhm means current of 5mA at 5V).
b) If the port is=20
bidirectional, 1k resistance is low enough to pull the pin 2 low, from =
5Volts=20
to 0 Volts.
4) If the read value changes this =
is a good=20
news: your port is a bidirectional one!
If it does not change, =
first, try to=20
change the settings in the BIOS of your PC (in the case when your LPT1 =
is on=20
the MB). Make few tries in this order: Normal, EPP or ECP.
If the =
test=20
doesn't pass, then you can't use the above shematics. But hey, do not =
give up.=20
Just consider some other options. For example this.=20
In this option you should drastically change the above schematics, and =
just a=20
little the program in the LPT-reading part. For example this=20
project uses multiplexed reading. But, using multiplexed data =
gathering,=20
nibble by nibble, you obtain twice as slower reading =
speed.
In=20
addition, there is a software test upon starting the program, which =
checks if=20
the hardware lets the software set the bit 5 of the LPT's control byte. =
Setting=20
the bit 5 of the control port to a logical high, we put a LPT port in =
the=20
bidirectional mode. There is lots of different ports around. =
Differently=20
protected, or not protected at all. Read this=20
article if you want to know more about this issue.
Those =
1kOhm=20
current limiting resistors between ADC and LPT are here just in case =
somebody=20
tries to connect this to a non-bidirectional port. You can omit this =
resistor=20
if you know that you are going to plug it in a bidirectional port only. =
I never=20
tested this schematics with those resistors, since I'm sure that my PC =
is a=20
bidirectional one. Or else this resistor could help if someone tries to =
send=20
something out (printing) when the oscilloscope is plugged in=20
LPT1...
10k, 1M resistors and 1N4148 and ZD5V are there for =
analog input=20
protection. Analog input (signal in) at the pin 1 should never exceed =
the=20
supply voltage of the ADC. If you are planning to measure the signals =
with=20
amplitude more than 5V, you should add an additional resistor divider =
between=20
signal and ADC to keep the voltage below 5V at pin1. And of course, you =
can=20
omit this protection and connect the signal directly to pin1 if you are =
sure=20
that your analog input will allways be in range of 0V-5V.
Pin 10 =
of LPT1=20
(Ack) acts like an external trigger. It is a TTL level trigger which =
fires at=20
rising edge.
ADC0820 works in wr/rd mode (pin7 high), =
stand-alone=20
operation.
To make a measuring sample, program has to set the pin6 =
low for a=20
very short time. After that (820ns ater that - regarding to =
datasheets), the=20
data is ready on data pins. Simple, isn't it. When doing the program, I =
was=20
worrying about timings, but during the testing, I realised that ADC0820 =
is=20
faster than any LPT port (available this days), and all the program has =
to do,=20
is a short low impulse at pin6 and read the data as quick as it can. I =
never=20
noticed any data was lost (eaten samples) during the testing. I must =
say that=20
any data wasn't lost in a DOS version of the program. Windows are a bad =
choice=20
for a heavy timing tasks such as a (software) oscilloscope. Windows =
runs other=20
programs in the background. That's why the win version doesn't have =
100%=20
accurate time base, but in other side it looks fancy.
The bottleneck =
in the=20
data transfer from ADC to PC is read/write routines of the LPT port, =
not the=20
speed of ADC0820. For one data sample we need 3 I/O instructions from =
PC:=20
_out (set pin6 of ADC low)
_out (set pin6 of ADC high)
_in (read a data byte from =
ADC)
Under=20
different OS and processor modes these I/O instructions take different =
number=20
of processor cycles. Read this=20
if you want to know more.
I tried to set an external oscillator for =
ADC clock=20
and avoid two "out" commands to save some time, but this way we loose=20
synchronisation between ADC and PC and data became messed. ADC must be=20
synchronised with the PC (does it?).
Conclusion: Almost =
everything I=20
know about parallel ports I learned at this great site: http://www.beyondlog=
ic.org/spp/parallel.htm.
Since=20
I have just few PCs available for testing, it is possible that many=20
unpredictable things (nice or bad) happen. I'm thankful for any =
suggestion from=20
you. I will update this page if you know or find out anything worth=20
mentioning.
Other LPT handling and programming related=20
stuff:
http://www.lvr.com/parport.htm
ftp://ftp=
.armory.com/pub/user/rstevew/LPT/zha96lpt.faq
...=20
Back=20
home =20