In any number of monitoring and/or control uses for your ZX/TS, you may find that using a TV set to check on your system is inconvenient or impractical. This would be so, for example, in outdoor or dirty environments or when you simply wish to check the status of one or two system parameters without the bother of hooking up a TV or monitor. One fairly easy and inexpensive way to do this is to use seven-segment LED (light-emitting diode) displays as your system output. Your ZX/TS bus doesn’t have enough power in reserve to directly drive these displays, but a few simple IC’s and an I/O board can give you this capability.
You must have an 8-bit output port. I used Ener-Z‘s Report Generator board (reviewed in SWN 1:5), but JK Audio‘s 310 and even Byte-Back‘s BB-1 module, without the relays (see SWN 1:4), should be usable as a buffered output from your computer. The only other hardware you’ll need, aside from miscellaneous wire and some resistors, is a 7416 hex inverting buffer, a 4511 BCD (Binary Coded Decimal)-to-7 segment decoder/driver, and a 3-character 7-segment LED display (MAN3). A schematic of this simple circuit is shown in Figure 1.
This circuit represents a “middle ground” approach to producing a 3-digit output display. More hardware (latches, etc.) can be used, resulting in permanently lighted displays, or we can use software to create a controlling outer loop to keep the monitoring function as the main operating system. The combination of hardware and software I chose represents a system which uses multiplexing to provide the appearance of a full three-digit display.
As you can see from Figure 1, we are using the ZX’s data lines D0 through D3 to send out the Binary Coded Decimal value of one of three digits (units, tens or hundreds). The correct digit is determined by the data lines D4 through D6 which complete the path to ground for the appropriate display. Line D7 enables and latches the appropriate elements of the display. Multiplexing is provided by the ML software driver routine shown in Figure 2.
After data is POKEd into the three buffer locations (Fig. 3a) the ML program outputs the specially constructed character code for each digit in sequence. This operation occurs so rapidly that the eye is fooled into thinking each digit is lit all the time. If you’d like to see what’s really happening, you can either increase the dwell time between digits or use the BASIC listing in Fig. 4. The BASIC listing requires no machine code, and is useful in understanding how the system works, but is, of course, slow.
LEDOUT SCHEMATIC
All resistors are 330 ohm 1/4 watt unless otherwise stated.

D7 D6 D5 D4 D3 D2 D1 D0 24= 0 0 0 1 1 0 0 0 40= 0 0 1 0 1 0 0 0 72= 0 1 0 0 1 0 0 0 D3-D0: Binary Coded Decimal code sent D6-D4: Digit Select D7: Latch Enable (active low) Codes: LEDOUT CODES TO SEND FOR DIGITS
Example:
To send the number “888”, transmit the codes 24, 40, and 72
Sequential Output will actually be: 24=" blank-blank- 8 "
40=" blank- 8 -blank "
72=" 8 -blank-blank "
which when displayed quickly
(multiplexed) will look like "888"
FIGURE 2. LEDOUT MACHINE CODE LISTING
Hex Disassembly
Addr Code Label Mnemonics Comments
409E 01FF00 LDOT LD BC,00FF ;Load # of cycles
40A1 219740 MAIN LD HL,HUND ;
40A4 3E04 LD A,04 ;# (5) of digits to send
40A6 F5 ENTR PUSH AF ;Save A-flags
40A7 7E LD A,(HL) ;Get output value from 4097h
40A8 328240 LD (4082),A ;POKE 16514 with value
40AB F1 POP AF ;Get original count
40AC 23 INC HL ;Point to next digit
40AD 3D DEC A ;only (A-1) digits left
40AE CABA40 JP Z 40BA ;Done all digits?
40B1 CD9829 OUTP CALL ENRZ ;Send digit out
40B4 CDC040 CALL DLAY ;Leave it lit
40B7 C3A640 LOOP JP ENTR ;Send next one
40BA 0D DEC C ;Decrement count
40BB C8 RET Z ;C=0 then RET to Basic
40BC C3A140 JP MAIN ;If C<>0 then do it again
40BF C9 RET ;Can't get here
40C0 114000 DLAY LD DE,0040 ;A simple time delay
40C3 1D TIM1 DEC E ;for how long we
40C4 CACA40 JP Z DLA2 ;leave each digit on
40C7 C3C340 JP TIM1
40CA 11AA00 DLA2 LD DE,00AA ;This is the outer
40CD 1D TIM2 DEC E ;loop of the time
40CE C8 RET Z ;delay
40CF C3CD40 JP TIM2 ;Keep looping
40D2 C9 RET
Decimal List
Address Value Address Value
16542 1 16569 64
16543 255 16570 13
16544 0 16571 200
16545 33 16572 195
16546 151 16573 161
16547 64 16574 64
16548 62 16575 201
16549 4 16576 17
16550 245 16577 0
16551 126 16578 64
16552 50 16579 29
16553 130 16580 202
16554 64 16581 202
16555 241 16582 64
16556 35 16583 195
16557 61 16584 195
16558 202 16585 64
16559 186 16586 17
16560 64 16587 170
16561 205 16588 0
16562 137 16589 29
16563 41 16590 200
16564 205 16591 195
16565 192 16592 205
16566 64 16593 64
16567 195 16594 201
16568 166
NOTE: To incorporate this code into memory, first create a 1 REM with at least 81 characters following the word “REM “. Then enter this temporary listing. Run it to enter the decimal value for each address shown in the accompanying “decimal” table.
1 REM 000000000000000000000000000000000000000000000000000000000000000000000000000000000
2 REM 81 CHARS ABOVE (MIN.)
10 FOR X=16542 TO 16594
15 SCROLL
20 PRINT X;
25 INPUT D
30 POKE X,D
35 PRINT "=";D
40 NEXT X
45 PRINT "DELETE LINES 2-45"
Addresses 16514 to 16541 are used as work space. BCD Data representing the hundred’s, ten’s, and one’s columns respectively of the number to be displayed by the LED are stored in memory locations 16535 to 16537.
Figure 3a. PROGRAM TO POKE DATA INTO BUFFER
Note: Lines 5 to 130 initialize values in the buffer. 50 to 220 serve as a subroutine to which you would GOSUB from your own program starting at line 1000.
1 REM 0000000000000000000000000000▒ COPY 5▒RNDY▒ PRINT XASN ▒RNDLN ▒DLN ""RND?▒RND$COS ?▒RND TAN ) RND1ASN ASN RND??RND)▒ 1COS ?LN.RNDTAN 0000
5 REM DO NOT EDIT LINE 1
10 REM LEDOUT 1.3
11 REM PJ DONNELLY
100 REM INITIALIZE
101 POKE 16514,0
102 POKE 16538,0
103 POKE 16539,0
105 POKE 16540,255
110 LET MENU=1000
111 REM MENU=MAIN PROGRAM
120 LET LEDOUT=16542
125 LET SETUP=16535
130 GOTO MENU
150 REM LEDOUT
160 PRINT " INPUT DECIMAL VAL "
162 INPUT D
164 PRINT D
170 REM NOW CONVERT D TO 3 SEPARATE DIGITS
172 LET H=INT (D/100)
174 LET T=INT ((D-H*100)/10)
176 LET U=INT (D-(H*100)-(T*10))
180 REM NOW CANGE TO OUR SPECIAL CODE
182 LET H=H+64
184 LET T=T+32
186 LET U=U+16
190 REM THIS COULD ALL BE PUT INTO THE 3 LINES- 172,174,176
192 POKE SETUP,H
194 POKE SETUP+1,T
196 POKE SETUP+2,U
200 REM SUBROUTINE TO CALL LEDOUT
205 FAST
210 LET X=USR LEDOUT
215 SLOW
220 RETURN
The software is applicable to the Ener-Z Report Generator as it stands. However, you can change the address of the call at 16561d to the address of your own OUTPUT subroutine. The R.G. board uses a PIO and is I/O mapped. For memory-mapped systems (like the BB-1) your OUTPUT subroutine would consist of simply putting the value into the accumulator, loading the designated memory location (3FFE on the BB-1) with the value, and returning to the driver.
I built this circuit on a small ACE (all-circuit evaluator) board and obtained its power from the +5V regulator on the R.G. board. The values for the current limiting resistors to the display are not critical, but should be as large as possible to conserve power, while still giving adequate brightness. Don’t overlook the 10K pull-up resistors for the 7416, or forget to tie unused inputs to ground.
Figure 3b gives a BASIC driver which I use to obtain a temperature reading from the A/D converter on the R.G. board and output that value to the LED display.
figure 3b. BASIC DRIVER FOR ENER-Z A/D BOARD
250 REM A/D OUT
260 REM FOR ENERZ BOARD
261 REM CHOOSE CHANNEL 0
270 POKE 16514,0
275 FAST
280 LET L=USR 10602
290 REM X IS A SCALE FACTOR
300 LET X=1
310 LET D=X*PEEK 16515
320 SLOW
330 GOSUB 172
340 GOTO MENU
Figure 4. BASIC LEDOUT DRIVER FOR USE WITH ENER-Z REPORT GENERATOR
1 REM AAAAAAAAAAAAAAAAAAAAA THIS IS A WORK AREA
9 FAST
10 REM BASIC LEDOUT
11 LET H=0
12 LET T=0
13 LET U=0
15 LET OUTPUT=10648
16 LET BUF=16514
20 DIM V(4)
100 REM MAIN
102 SLOW
105 PRINT "INPUT DECIMAL VALUE"
110 INPUT D
112 PRINT D
115 LET H=64+INT (D/100)
120 LET T=32+INT ((D-(H-64)*100)/10)
125 LET U=16+INT (D-(H-64)*100-(H/32)*10)
130 LET V(1)=H
135 LET V(2)=T
140 LET V(3)=U
145 LET V(4)=0
150 FOR J=1 TO 50
155 FOR I=1 TO 3
160 POKE BUF,V(4)
162 FAST
165 LET X=USR OUTPUT
170 NEXT I
180 NEXT J
183 POKE BUF,V(4)
185 LET X=USR OUTPUT
190 PRINT "AGAIN?"
192 INPUT A$
193 IF A$="Y" THEN GOTO 105
194 IF A$="D" THEN GOTO 200
195 STOP
199 REM LEDOUT
200 POKE 16514,0
205 FAST
210 LET L=USR 10602
220 LET D=PEEK 16515
222 SLOW
225 GOTO 115
230 STOP
The code shown would actually be a subroutine called from a main menu. The display is normally blank. By touching, say, “T” on my keyboard, I would be selecting a menu item which calls the Temperature output subroutine. All this can be done without the need of a TV screen, if I know in advance (and I do) which key to press. The system could be expanded, with more chips, lots of software and perhaps even LCD displays (for low power consumption) to actually let you program your computer without a TV. A consideration here would be to use hex buffer drivers instead of BCD for hexadecimal monitoring.
Note too, that I used “junk box” parts from around my shop to build this particular display. A proper design would use perhaps a 74LS248 for the latch driver (pinout is the same as the 4511.) Also remember NOT to output codes which will turn on all three digits at one time (e.g. binary code 01111111 produces all 8’s) as the current drain will be quite high, and perhaps more than your wall-plug supply can handle.
LEDOUT CODES TO SEND FOR DIGITS IN VARIOUS COLUMNS
DIGIT in: 100's col. 10's col. 1's col. 0 64 32 16 1 65 33 17 2 66 34 18 3 67 35 19 4 68 36 20 5 69 37 21 6 70 38 22 7 71 39 23 8 72 40 24 9 73 41 25