e00a068.pdf
(
839 KB
)
Pobierz
000096-UK univ.interface
COM
PUTER
Centronics/I
2
C Interface
with logic analyser
by Ingo Gerlach DH1AAD
e-mail: IngoGerlach@welfen-netz.com
When this interface is connected to an extended parallel printer port
(EPP), your PC can communicate using the I
2
C protocol, and it can also
make direct read and write accesses to eight data bits.
bilities port), it became possible to
directly read in 8-bit data via the
data bus. Following the introduction
of these modes, a steadily increasing
number of peripheral devices (such
as scanners) utilise the parallel inter-
face for communications with the
PC, since a suitably high data trans-
fer rate can only be achieved if the
data are read directly.
Hardware
Most of the I
2
C interfaces that have been
described in
Elektor Electronics
up to now are
based on a Philips application note. This cir-
cuit is no exception. However, its special fea-
ture is the combination of an I
2
C interface
with an 8-bit parallel interface. The parallel
port of the PC can be used for control, since
8-bit output was defined for this port by IBM
from the very beginning. However, since the
data lines were only intended to be used for
output, it used to be necessary to
resort to a trick in order to read in
data. This consisted of using the sta-
tus port of the interface to read data.
Since the status port is only five bits
wide, data had to be read in 4-bit
nibbles.
With the development of new
modes such as EPP (enhanced par-
allel port) and ECP (extended capa-
The hardware of the I
2
C/8-bit inter-
face, as shown in
Figure 1
, consists
only of a 25-pin connector and a few
driver and inverter gates. I
2
C com-
munications take place via gates
IC3b and IC3d, IC3e and IC3f. SDA
and SCL are driven via the two data
lines D0 and D1, and they are read
via UserB2 (pin 15) and Intr (pin 10),
respectively, on the EPP interface
connector K1. A few pull-up resistors
provide the proper voltage levels.
The clock and data lines of the I
2
C
bus are located on pin 3 (SCL) and
pin 5 (SDA) of the combination pin
connector K2, and they are also
brought out to solder posts, along
with ground.
The PC can determine whether an
adapter is connected (
init iic
) via the
loopback connection formed by gate
IC2b between pin 17 (nAStrb) and
pin 13 (XFlagUser3). The bi-direc-
tional 8-bit bus driver IC1 is acti-
vated via pin 16 of the control port
68
Elektor Electronics
10/2000
Versatile
COM
PUTER
EPP interface pin
assignments
Pin
R2
R6
R7
R3
5V
IC3d
8
9
SDA
1
Function
1
nWrite
4
3
SCL
1
IC3b
I C
2
2
Data D0
K1
IC3e
10
12
IC3f
3
Data D1
1
1
1
4
Data D2
14
5
Data D3
11
13
2
IC1
6
Data D4
15
5V
7
Data D5
3
1
K2
16
8
DataD6
2
2
18
D0
D1
D2
D3
D4
D5
D6
D7
+5V
GND
SDA
SCL
STROBE
25
26
4
9
Data D7
3
4
17
23
24
17
16
21
22
10
Intr
5
5
6
15
19
20
11
nWait
18
14
17
18
6
12
UserB1
7
8
9
13
15
16
19
13
XFlagUser3
12
13
14
7
11
11
12
14
nDStrb
20
9
10
15
UserB2
8
1
7
8
21
3EN1
16
nInit
9
3EN2
5
6
17
nAStrb
19
3
4
22
R1
G3
1
2
PE
18...25
Masse
10
74LS245
23
IC2a
IC3a
11
2
1
1
2
1
1
24
Output connector K2
pin assignments
12
25
IC2f
13
4
3
5
6
12
13
1
IC2b
1
IC3c
1
C1
R4
R5
R9
R8
R11
R12
Pin
Function
10n
1
Strobe
5V
5V
5V
3
SCL
5
SDA
IC4
5V
IC2, IC3 = 74LS06
7
Ground
7805
5V
9
+5 V (Output)
B1
R10
11
Data D7
IC2c
5
IC2d
9
IC2e
11
13
Data D6
C3
C4
C2
20
C7
14
C5
14
C6
1
1
1
15
DataD5
D1
IC1
IC2
IC3
470µ
25V
100n
10µ
63V
100n
100n
100n
10
7
7
6
8
10
17
Data D4
B80C1500
19
Data D3
21
Data D2
000096 - 11
23
Data D1
25
Data D0
2
PE (Input)
Figure 1. The hardware of the interface consists of a few gates and an 8-bit bi-
directional bus driver.
(nInit), which determines whether
the interface circuit works in the I
2
C
mode or the parallel mode (DLL
io
enable
and
io disable
functions). The
data transfer direction (read or write)
is selected via nWrite and gate IC3a
(Low = read, High = write). Finally,
the RC network R1/C1 and gate IC2a
provide the required data input
acceptance pulse on pin 11 of K1
(nWait). The correct timing for a read
sequence is shown in
Figure 2
.
All these components, along with
a simple voltage regulator formed by
B1, C2-C7 and a 5-V regulator (IC4),
plus a function lamp (D1), are
mounted on the printed circuit board
shown in
Figure 3
. The ICs must be
pull-up resistors are
mounted vertically, and their free
ends are attached in common to a
single wire that connects to +5 V at
the end of the row of resistors. A
small 9-V transformer, or better yet a
simple 9-V mains adapter, provides
an adequate source of power.
Ω
000096-11
. Since these are based on the C
functions
outp
and
inp
, which directly access
the hardware, they work only under Windows
95/98. They cannot be used under Windows
NT, since NT prohibits direct hardware
access. The file
I2CEPP.BAS
provides a sort of
interface between the DLL and an application
program, such as Visual BASIC. The functions
and calling parameters are declared and
described in this file.
Test program
DLL and BAS
The diskette includes a simply structured 8-
channel logic analyser, which can be used
without any additional hardware for testing
the interface and displaying eight TTL-level
signals on the screen. A maximum of 64,000
All functions are located in the file
I2CDLL.DLL
, which is available
along with the rest of the software
on a diskette with order code
10/2000
Elektor Electronics
69
mounted in suitable sockets, since
some of the eleven wire bridges run
underneath these components. Most
of the 10-k
COM
PUTER
data
n Write
Td
data byte
On disk set #000096-1/4
SETUP LST 8.474 04-03-00
ST4UNST EX_ 33.149 04-03-00
SETUP EXE 59.392 04-03-00
SETUP132 EX_ 68.950 04-03-00
STKIT432 DL_ 12.439 04-03-00
VB40032 DL_ 471.576 04-03-00
VEN2232 OL_ 23.683 04-03-00
OLEPRO32 DL_ 89.431 04-03-00
MSVCRT20 DL_ 154.560 04-03-00
MSVCRT40 DL_ 23.256 04-03-00
CTL3D32 DL_ 15.385 04-03-00
VB4DE32 DL_ 11.179 04-03-00
COMDLG32 OC_ 74.496 04-03-00
MFC40 DL1 408.187 04-03-00
MFC40 DL2 134.144 04-03-00
MFC40LOC DL_ 14.265 04-03-00
TABCTL32 OC_ 128.754 04-03-00
RICHTX32 OC_ 117.028 04-03-00
COMCTL32 OC_ 318.415 04-03-00
CCTLDE32 DL_ 12.091 04-03-00
DBLIST32 OC_ 117.805 04-03-00
DBGRID32 OC_ 185.161 04-03-00
GRDKRN32 DL_ 124.298 04-03-00
MSRDC32 OC_ 68.918 04-03-00
MSRDO32 DL_ 147.902 04-03-00
MSRDDE32 DL_ 5.906 04-03-00
MSOUTL32 OC_ 43.502 04-03-00
LA EX_ 15.469 04-03-00
CD4017 L_ 8.567 04-03-00
DREHGEB1 L_ 9.367 04-03-00
DREHGEB2 L1 3.069 04-03-00
Th
DREHGEB2 L2 6.144 04-03-00
I2C_DLL DL_ 12.243 04-03-00
GRAPH01 IC_ 505 04-03-00
COPYRI~1 TXT 188 17-08-00
CONTEN~1 TXT 822 17-08-00
CONTEN~2 TXT 1.035 17-08-00
CONTEN~3 TXT 411 17-08-00
Te l
Te s
nD Strobe
n Wait
X Flag
n Init
nA Strobe
CONTEN~1 TXT 0 17-08-00
COPYRI~1 TXT 182 17-08-00
cd4017 la 64.002 19-02-00
diagramm Bas 11.170 18-02-00
drehgeb1 la 64.002 21-02-00
drehgeb2 la 64.002 28-02-00
epp_la bas 2.901 22-02-00
FILEDI~1 BAS 11.566 19-02-00
GRAPH01 ICO 1.078 15-08-95
I2CEPP bas 6.023 04-03-00
I2C_DLL dll 22.528 21-02-00
la exe 36.352 04-03-00
la LA 64.002 19-02-00
la vbp 1.378 26-06-00
la vbw 116 26-06-00
la_main frm 19.205 26-06-00
la_main frx 1.090 26-06-00
MSSCCPRJ SCC 189 26-06-00
000096 - 12
Figure 2. A read sequence using the EPP
interface.
measurements can be made (controlled via
the Counts slider), and the region to be dis-
played can be selected using the StartShow
and EndShow controls. The measured values
can be stored and read back in. The Strobe
signal (pin 1 of K2) is pulled low during a
measurement.
It is also possible to initiate measurements
externally. The check box PE Trigger must be
set for this. In this case, the measurement
starts only after pin 2 of K2 goes Low.
SCL
SDA
K1
C1
C6
(000096-1)
R7
H1
R1
C7
Literature:
Parallel Port Complete, Jan Axelson;
Lakeview Research, ISBN 0-9650819-1-5
R9
R3
R2
R8
*
R6
COMPONENTS LIST
R4
~
R11
C3
C4
Resistors:
R1 = 22k
R5
~
Ω
R2-R9,R11,R12 = 10k
000096-1
C5
B1
D1
C2
Ω
H3
R10
IC4
R10 = 1k
Ω
Capacitors:
C1 = 10nF
C2 = 10µF 63V radial
C3 = 470F 25V radial
C4-C7 = 100nF ceramic
Semiconductors:
D1 = LED, high efficiency
IC1 = 74LS245
IC2,IC3 = 74LS06
IC4 = 7805
Miscellaneous:
K1 = 25-way sub-D plug (male), PCB mount
K2 = 26-way boxheader or pinheader
B1 = B80C1500 in round case (80V piv,
1.5A peak)
PCB, order code
000096-1
Project software on disk, order code
000096-11
Figure 3. The hardware is mounted on this small printed circuit board.
70
Elektor Electronics
10/2000
Plik z chomika:
gasma
Inne pliki z tego folderu:
Elektor Electronic #275 March 1999.pdf
(20071 KB)
bge.jpg
(22 KB)
detail1.htm
(5 KB)
detail2.htm
(5 KB)
detail3.htm
(6 KB)
Inne foldery tego chomika:
1974
1975
1976
1977
1978
Zgłoś jeśli
naruszono regulamin