Anda di halaman 1dari 4

11I

INITIALIZATION AID FOR PRINTERS


A. Rigby

Many computer users have difficulty in changing printer settings


without the help of a manual or handbook. The circuit presented here
allows one of sixteen pre-programmed printer settings to be called
up at the flick of a switch. Very useful for a good many computer
programs that lack a real printer driver, the initialization aid is a
low-cost and simple-to-build circuit.

You are working ha rd on a BASIC pro- Basic operation sure stable levels on the datalines. After
gram which is almest finished, and hard the 5 I ROBE output line is actuated, the
copy on paper is required to da the final The flowchart in Fig. 1 illustrates the basic circuit en tera a wait loop to allow the
debugging. Since the program is fairly operation of the circuit, which is inserted printer to process the databyte. Depend-
long, you think it wise to set the printer to between the compurer's Centranics port ing on the position of jumper [Pr, the cir-
condensed characters at 8 l.ines per inch. and the parallel input of the printer. The cuit waits for a negative pulse transition
The printer manual is consulted and the diagram shows the functional blocks in on the BU5Y or ALK handshaking line
following command is typed in the direct the circuit as well as the interrelated tim- from the printer. When the transition ar-
command mode of GWBASIC: ing at which these blocks operate. rives, the EPROM address counter is in-
At power-on, the circuit is reset and cremen ted by one. The counter starts at
LPRINT CHR$(15);CHR$(27);"O"; forms a straight 36-way connection be- the lowest address, rul, by virtue of the
tween the computer's Centronics por t and power-on reset. and the fact that the cir-
We think you will agree that pushing a the Centronics in pu t on the printer. No cuit stops automatically when the counter
small button on the printer initia lization change is made to the previously estab- reaches nil. In the latter ease, the "all 16
aid is a lot easier than having to look up Iished printer setfing. and the computer bytes sent?" Ioop in the flowehart is left
eight or so ASCII characters, and typing can send printer files as before. via the "yes" exit, end the circuit forms a
them into the computer wh ilst observing When 52 is pressed, data buffer rcs straight connection between the computer
the correct order. brackets and delimiters. blocks the datastream from the computer. and the printer until 52 is pressed again.
In the above example, BASIC fortu- The circuit actuates the BU5Y line to force All 16 bytes stored in the EPROM are
nately allows the printer to be set to the the computer to stop sending data. Mean- to the printer und er the control of strobe
required rnode. albeit in a rather complex while, the data outputs of the EPROM, pulses. which are started with the aid of
way prone to many errors. There are, IC7, are enabled, so that the byte at the the delayed BUSY or AIT printer signal.
however, many programs that lack even currently addressed Iocation in the The delay allows some time for the ad-
the most rudimentary means to set the EPROM is sent to the printer. Astrobe dress counter ro reach the next higher out-
pt-inter to a particular character or paper pulse is genera ted to signal to the printer put state. When a11bytes have been sent,
format. For such programs, the inifial iza- that a byte is held ready for transmission. the same delay 1S used to reset the circuit
tion atd is a useful peripheral, provided its Sinee the start of the first strobe pulse to its start canfiguration.
setting is not overrtdden by a printer in- coincides with the moment the EPROM
itialization string prefixed to each print- datalines are enabled, the strobe pulse is
able file by the program in question. delayed by about cne mieroseeond to en- 16x16 in control
Apart of the circuit drawn in Fig. 2 consist
of a set of printed-circuit board tracks
called the contral bus. This bus takes a11
Centronics control signals not used by the
initia lization aid frorn the input- to the
output connector. Two Iines, C18 and C35,
form an exception, because they may be
used to power the circuit. Whether or not
they can be used for this purpose depends
on the printer used. Diodes 02, D3 and D4
form an OR function that allows the cir-
cuit to be powered by different supplies.
In case the printer lacks a +5 V output on
its Centranics connector, the eircuit is
powered by a 9 VOC mains adapter via 02
and volta ge regulator IC9. lf the printer
supplies +5 V via line C18, the circu.it is
powered via D3. If +5 V i.savailable on Une
C3S, D4 is used for the same purpose. The
current consumption of the circuit does
not exceed SO mA.
As already discussed, the circuit 1S
reset automatically the moment the sup-
ply voltage 1S present. Bistable FF2is reset
by R9-C2, and in turn clears address
counter ICS. Bistable FFl is configured as
ELEKTOR ELECTRONICS FEBRUARY 1990
INITlALlZA TlON AID FOR PRINTERS

lITID
0 0 0 0
address range
iniUatization data

00
10
...
OF
...
1F
0 0 0 1
0 0 1 0 20 ...
2F
0 0 1 1 30 ...
3F
0 1 0 0 40 ...
4F
0 1 0 1 50 ...
5F
0 1 1 0 60 ...
6F
0 1 1 1 70 ...
7F
1 0 0 0 80 ...
8F
Swltch lC8 outputs 1 0 0 1 90 ...
9F
to aetate. BLock
ccmputer data; 1 0 1 0 AO ...
AF
enable data outputs 1 0 1 1 BO ...
BF
01 EPAOM K:7
1 1 0 0 co ... CF
1 1 0 1 00 ... OF
Putbyte at EPAOM ad- 1 1 1 0 EO ... EF
dress on datallnes; FO ... FF
start first strobe
1 1 1 1
putse (AIO/e5)

O=switch closed
1=switch open
900007· T1

Table 1. DIP switch settings.

The circuit waits until the printer is


ready to accept a new command by moni-
toring either BU5Y or ALK. The selection
between these handshaking signals Is
made by the user with [umper JPl; the two
are equally suitable. provided the printer
supplies the relevant signal. Whatever
signal is used, the negative pulse edge
signals readiness to accept a new charac-
ter. The pulse edge docks address counter
Incremen! addrese fes and causes a new strobe pulse to be
counter
(gel next byte generated. The start of the strobe pulse is,
!rom EPROM)
however, delayed by Rll-C3 to prevent an-
Oisable EPAOM data- Starl next
other pulse being genera ted when the
llnes and enable strobe pulse using 16th (last) byte has been sent to the
buffer IC8;restore Y"
datallow between de~~;~ ;:1lJkve printer. This delay is used by the circuit to
computer and traneülcn block FFI before it receives a new clock
prlnter
pulse. The end of the printer initialization
900007· 11 sequence is marked by output QD of the
address counter going low when count 16
is passed. The change from 16 to 0 causes
Fig. 1. This flowchart iIIustrates both the structure of the circuit an the pertinent timing.
FF2to be clocked, so that FFI 1S blocked -
hence, the clock pulse genera ted in the
mean time by Rll-C3 has no effect. The
a monostable multivibrator (MMV) and to be taken high by N1-NI7 and N2-NI8 toggling of FF2also resets the circui t to its
does not require a power-on reset because respectively. The low level at the Q output initialstate.
it goes to the stand-by state on its own. At of FF2enables the databuffers in EPROM The circuit is fully compatible with the
this stage, the circuit functions as a 36- [C7,and ends the reset state of counter [es. Centronics interface on the computer as
way connection between the computer at The first strobe pulse is genera ted by FFI weil as on the printer by virtue of pull-up
the input (Kr) and the printer at the output which receives at its S (set) input a short resistors and open-collector TTL drivers
(K2). The two devices are connected via pulse from the Q outpur of FF2 via net- respectively. DIP switch block 51 selects
three-state inverter /buifer ICB, inverters work RIO-Cs. The length of the strobe one of 16 printer initialization strings
N9-N 16and the gates inserted in hand- pulse Is determined by R12-C4.Capaeiter which have been pre-programmed in the
shake lines BUSY, STRaBE and ACK. C~ slowly discharges after FFI has been EPROM. The selected address ranges in
When 52 is pressed, its contact noise is set, and resets the bistable. Consequenüy. the EPROM are listed in Table 1. If fre-
eliminated by debounce network R7-Cl. output Cl goes high, so that C, is rapidly quent changes are expected in the setting
The short pulse genera ted by CI-R8 pre- charged again via D1. This ensures that of this switch, it may be replaced wi th a
vents the initialization sequence being re- FFI is ready to genera te the next strobe more ergonomical type or a set of swit-
started on completton if the switch has not pulse. ches, e.g., four nurnature 5PST types or a
been released in the mean time. Actuation The strobe pulse is delayed by about thumbwheel switch.
of 52 causes FF2 to be set. The resultant one microsecond in network R13-C6to
high level at the Q output of FF2causes the allow sufficient time for the EPROM data
outputs of three-stare buffer lCB to be to reach output connector Kz. Gates Na
Construction
switched to the high-impedance state, and and N19 feed the strobe pulse to the The construction of the circuit on the
the BUSY and ACK inputs of the computer printer. double-sided, through-pleted printed-cir-
ELEKTOR ELECTRONICS FEBRUARY 1990
COMPUTERS AND MICROPROCESSORS

r~l~,l
r~/+
E- "1·]B~~:·]3~·]
o-1r'----~'~'tc'tc'tc~6~'~.~9t_------------------------~9
A'
5V

Y>
"
DD
"
ec
..E-
o-+'L--------t-t-t-t-t-t------------------------~. A' y,
va ta
" oa"
o-1r'-----------1~C-C-t_t_------------------------~' A'
o-+''------------t-t-t-t------------------------~6 A' 'CS v. ts" D3
E
"
o-~6------------~>-C-t_t_------------------------~' A' 74HCT D4

"
o-+,L----------------t-t------------------------~' A6 540
Y5
ns
>; ,.
"
o-~.--------------------t_------------------------_1' A'
Y6
" -e
as
o-+9'- I~
V7
VB
" D6

~------------------------~2A8
I~
18
" "
" "
~ "
,.
ta" c"
c,,_~///-0
c"
control bus
0////////////_0////////////////////////////////-0:1-.
CIS C35
"::s: (:%: eIl
"
12
"ts C>5 2:'~~ D'~~ 05V §: 1% c" "

,--------------,
H~~6~ ~,:,1"*
c" 1N4001 ~ ~_ CI. 14
"
~ ~:: ::
ctt
" CIS);:
"ao c"
at c" , B 74HCT
'C5
QAf'~'--+-+-++-----t--~'DqAO ~:e 00 11 00 ~ cle 18
az C32_~ 03 OB 9 9 Al 01 12 01 C30 30
~i\
aa cn --' RO(I)
cc B 8 A2 02 13 02 Cl1 31
cn az
D' rs
Cl4 ~~
"
as '%
,2 RO(2) 00"

+-+++-----t--~6,A4
7A3
IC7
03
cn aa
C"
2764 D' " 04
ae C36 /';
+-+-+- +__ ~5 A5
D' " os C34
"
"ao H--+---'!' A6 D6 " ",
C" as
C36 ae
". +-----+--~' A' D' "
" r+-+-++, 25 A8
,N° , ,

,
DD
"
aa
24 A9

V
+-+---""l'
A 11}
or 31,Nl0 4 a
"
as
23 All
es
Q +-+---'12 20
A 12
ze 26 Ne OE 22
fS oa 5~116 4

" fSf:S D3 9~128 5


" ................
O---1HC-------'"
_I.
" .... 6 ~
~
"
11~13106

~ os 13KN14 127

fS D6 lN15 28

~ V.
31~164 9
" V

1N4148 r---

L--
c~~

h..l..
r + 5V
C:t C~

STR08E
e_ 10 ~'~~~)o'-++--;~~;;t----_---'~"'l~N~S)l'l"
I1N N19,o 1

Nl~, ...--.,~ ~,~, R'i2 "[~ ~ 5TROBE


O-~'~'~.U~5~V~~·<><
5 Nl '\"+--------------------1~C--------+-=O~=c-C~~C7~~-----C~~,~'f_o
T FF1,FF2 _IC6 _74HCT74 eusv
lA B N1 N4 = IC1 = 74HCT02
JP1 0 ~ NS N8 = IC2 = 74HCT132

" ,' N2 ~,
6
~
N9 N14=IC3=74HCTOS
-<~N~15~.~
.. __ ~=='~Dt-o
N~2~0~:~I~C~4~:~7~4~H~C~TO~5c-
'-- ACK
ACK L.......:....

Fig. 2. Circuit diagram of the printer initialisation aid, a very useful peripheral device for advanced computer users.

ELEKTOR ELECTRONICS FEBRUARY 1990


(mind the position of pin 1 of each connec-
INITIALIZA TlON AID FOR PRINTERS
11
tor). Next, sold er the fingers to the pins,
taking good care to avoid short-circuits 10 RESTORE
between adjacent pins. Bolt the voltage 12 OPEN "lptl:" FOR cmrur 1IS #1
regulator direct on to the board - a heat- 20 FOR N'l TO 16
sink is not required. 30 RE1J) X
40 PRINT #l.CHR$(X);
50 HEXT N
STRDBE
DATAO '"'
G" Printer command strings 55 CLOSE
DATA 1 G" 60 DATA &H54.&H45.&H53.&H54
DATA 2
DATA J
G"
GNG Upon completion of the board, the
DATA. GNG 65 Jll.TA &HOO,&HOO,&HOO.&HOO
OATA5 GNG EPROM must be loaded with data. The 70 DATA &H54.&H45.&H53.&H54
OATA6 GNG
OATA 7 GNG manual supplied with your printer 75 DATA &HOO,&HOO,&HOO,&HOO
AC< GNG
aUSY GNG
INPUT PRiME RETURN (GNOl
should give ample Information on com-
AUTSJ~~
" ~~~~VJNPUT PRIME) mand strings to achieve the settings you 900007· 14

N.C. LDGIC GNO require. The circuit allows a maximu m of


LDGle GNO
CHASSIS a ~5; 16 command strings to be programmed,
." omrrm
each with a fixed length of 16 bytes. The
Fig. 5. GWBASIC test program listing.

mini EPROM programmer described in databytes to be programmed fra m


Ref. 1 is suitable for loading the 256 bytes.
If the required initialization sequence is databyte = 255-data.
900007·13 shorter than 16 bytes, the rernainder must
provide null characters (00), or any other This inverts each byte to negate the inver-
character which is ignored by the printer sion in the output buffers.
Fig. 3. Centrenlee connector pinning. (again, consult your manual).
The sequence of comrnands to be pro-
cuit board shcwu in Hg 4 is straightfor- grammed in the EPROM Type 2764 is first Reference:
ward. The pins of the Centronics connec- tested 'on line' with the aid of, say,
tors are simply pushed over the relevant GWBASfC Document the final versions 1. Mini EPROM programmer. Elektor
copper fingere at the edges of the boa rd of the command strings. Next, com pile the Etectronice January 1990.

Parts list

Resistors:
Rt -= SIL reststör array 8x10k
R.-R6~10k
R7 = lMO
Rs;AHJ;R11 - R15 = 2k2
R9 = lOOk

Capacitors:
C, = 10n
C2 = 4700
C3;CÖ= lnO
C, = 4n7
Cs = 470p
C7;Ca;ClO - C'3 ~ 1000
C9= 3300

Semiconductor5~
,.,01 ~ 1N4l48
02;03;0. = 1N4001
IC, = 74HCT02
IC. = 74HCT132
IC3;IC4 = 74HCT05
ICs = 74HCT93
ICö = 74HCT7 4
IC7 = 2764 or 27C64(A)
ICö = 74HCT540
IC.= 7805

Misceltaneous:
K 1 "" 36·way female Oentronics connector
with straight pins.
K2 -= 36~way male Centronics co:nnectorwith
straightplns.
S, = 4-way OIP switch block. .
S. = ITW Oataswitch push-button.
3'-Way pin header.
Jumper.
PCB Type 900007 (double-sided; through-
piated; see Readers Services page).
Fig. 4. Component mounting plan for the double-sided, through-plated circuit board.

ELEKTOR ELECTRONICS FEBRUARY 1990

Anda mungkin juga menyukai