git @ Cat's Eye Technologies Electronics-Projects / 60b6009
Add more READMEs (converted w/pandoc, unedited) to make browsable. Chris Pressey 5 years ago
3 changed file(s) with 301 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 Electronics Projects
1 ====================
2
3 * [LED-386](led386/README.md)
4
5 A 386-based LED blinker.
6
7 The LM386 audio amplifier IC, that is...
8
9 * [Mildred](mildred/README.md)
10
11 Mildred is a 4MHz Z80-based homebrew computer with 40K of memory (8K EEPROM, 32K SRAM.)
12
13 * [The 'Kitsilano' Oscillator](kitsilano/README.md)
14
15 An oscillator circuit that contains two NPN transistors and a single capacitor.
0 The 'Kitsilano' Oscillator Circuit
1 ==================================
2
3 Introduction
4 ------------
5
6 **Kitsilano** is an oscillator circuit based on two NPN transistors and
7 a single capacitor. It is so named because it is the most interesting
8 circuit (really, the only significant circuit) that I designed while I
9 was living in the Kitsilano neighbourhood of Vancouver, British
10 Columbia, Canada. Its design was a byproduct of a quest which I have
11 since recognized as futile, and abandoned: the design of a
12 single-transistor, inductor-less oscillator. The pursuit itself was
13 somewhat interesting though, so I'll tell you about it in the next
14 section. In the third section, I'll describe the Kitsilano oscillator
15 itself.
16
17 1Q0L
18 ----
19
20 <div id="figure1">
21
22 ![The 'Kitsilano' Oscillator
23 Circuit](1Q0L_oscillator.png "Figure 1. A single-transistor (and apparently inductor-less) oscillator.")
24
25 Figure 1. A single-transistor (and apparently inductor-less) oscillator.
26 (From [Sessions 1975](#1)).
27
28 </div>
29
30 The notion of a single-transistor oscillator, built without an inductor,
31 tantalized me for a while after I came across what looked like such a
32 circuit in a book of somewhat older circuits that I checked out from the
33 public library^[\[1\]](#1)^. It is shown in Figure 1. It clearly
34 contains only one transistor and no coils, and the caption claims that
35 the tone it produces, though not loud, is adequate for keying (that is,
36 Morse code) practice. Further, the circuit is organized in a way that
37 coincides with my understanding of how one might go about eliminating
38 the inductor from a Colpitts oscillator: by replacing it with a
39 capacitor and a resistor in parallel and in series with another
40 resistor, an arrangement which can be thought of as a very rough
41 equivalent to an inductor.
42
43 However, every attempt I made at building it failed to produce any
44 results. It was not until much later that I came up with a plausible
45 theory for why it didn't work. The audio output in this circuit was
46 shown as a pair of headphones labelled "Hi-Z". This means
47 "high-resistance", and indicates old-style *piezoelectric* headphones
48 rather than the more modern magnetic-coil speakers. What took me so long
49 to realize is that piezoelectric elements are crystals, and *crystals
50 provide inductance* (which is why they can be used in crystal
51 oscillators!) In this circuit, the headphones are apparently a critical
52 component which acts as an inductor in the oscillator. I haven't been
53 able to hunt down a genuine crystal-element earpiece yet, so I haven't
54 been able to test this theory, but it's the best idea I've come up with
55 yet for why it doesn't work without one.
56
57 The Design of the Kitsilano Oscillator
58 --------------------------------------
59
60 <div id="figure2">
61
62 ![The 'Kitsilano' Oscillator
63 Circuit](kitsilano.png "Figure 2. The 'Kitsilano' Oscillator Circuit.")
64 Figure 2. The 'Kitsilano' Oscillator Circuit.
65
66 </div>
67
68 Having given up on a single-transistor, inductorless oscillator, and
69 discovering in other library books several single-transistor,
70 one-inductor designs (such as the Colpitts oscillator), I concentrated
71 my efforts on designing a two-transistor, no-inductor oscillator.
72
73 I had encountered several two-transistor designs previously. One is the
74 "multistable multivibrator", which uses two transistors of the same
75 type, and two capacitors. Each transistor-capacitor pair acts as a timer
76 which triggers the other pair when it has discharged. Another design
77 involves only a single capacitor, but two transistors of complimentary
78 type (NPN and PNP.) Many circuits based on both of these oscillator
79 designs can be found in Mims^[\[2\]](#1)^.
80
81 Well, what I wanted was an oscillator built from two transistors of the
82 *same* type, but incorporating only *one* capacitor. This effort
83 resulted in Kitsilano.
84
85 The theory of Kitsilano's design was adapted from a fairly standard
86 oscillator design that utilizes two CMOS inverters. This is usually
87 implemented with half of a 4001 chip (tying the inputs of each NAND
88 together to form an inverter.). One of the inverters is fed its own
89 output through an RC circuit, and the other inverter is used to
90 stabilize the feedback and "square off" the output. Circuits
91 incorporating this oscillator design can also be found in
92 Mims^[\[2\]](#1)^.
93
94 (In fact, it's not required that such an oscillator be constructed from
95 CMOS gates. [This figure](2NOR_oscillator.png) shows a circuit along the
96 same lines that I built from LSTTL NOR gates, driving a
97 series-resistor-less LED via a transistor. Measuring the current usage
98 shows why CMOS is preferable: LSTTL uses a lot.)
99
100 Kitsilano uses the fact that **an inverter can be built with a single
101 transistor** to replace the two CMOS inverters with two transistors of
102 the same type. The remainder of the circuit is officially a hack, since
103 it was designed "by dint of sheer building." The circuit is depicted in
104 Figure 2.
105
106 For the construction itself, I chose two 2N4124 transistors — they're
107 NPN and they're about as cheap as they come. The requisite task of an
108 oscillator, as far as I'm concerned, is to blink an LED, so I chose C1
109 large enough to make this action visible to the unaided eye.
110
111 R1 was not originally part of the circuit: there was no connection
112 between Q1's base and +5V. This oscillator would oscillate sometimes,
113 while at other times would fail to oscillate. I eventually discovered
114 that it was very sensitive to where my hands were placed above or around
115 the circuit, so I added to the high-resistance path to +5V to make sure
116 there was always some voltage at Q1's base, making its behaviour more
117 stable.
118
119 D1 was originally a resistor (I forget the ohmage.) The circuit worked
120 fine with a resistor there, but I wanted something stranger, so I
121 experimented with replacing it with a diode. This worked too, although I
122 cannot quite tell you why (does the voltage drop across the diode serve
123 the same function as the resistance?) so I kept it in.
124
125 References
126 ----------
127
128 1. [Kendall Webster Sessions, ed. *Master handbook of 1001 practical
129 electronic circuits.* Blue Ridge Summit, Pa. : G/L Tab
130 Books, 1975.]()
131 2. [Forrest Mims III. *Getting Started in Electronics*. Master
132 Publishing, Inc., 2003. ISBN 0945053282.]()
133
0 Mildred
1 =======
2
3 *January 10 2003*
4
5 ![Photo of Mildred](doc/mildred_photo.jpg)
6
7 Mildred is a homebrew computer. Since it is continually changing, this
8 document describes both the current state of Mildred, and what it would
9 be nice for it to eventually be.
10
11 Overview
12 --------
13
14 The core of Mildred resides on a single board, and consists of a power
15 supply, clock, central processing unit (CPU), reset circuitry, address
16 decoding circuitry, memory, built-in I/O devices, and an external
17 interface connector.
18
19 ### Board
20
21 The board is from Radio Shack and is a copper-pad-per-hole protoyping
22 board. Components are soldered to the board, with point-to-point wiring
23 and some fairly ugly solder bridges used to connect them. Sockets are
24 used for all ICs so that they can be extracted and replaced when needed.
25
26 ### Power Supply
27
28 The power supply consists of a 7805, which regulates the incoming
29 voltage (from a 6V-9V wall AC adapter) to 5V. The excess power is
30 disapated as heat. A diode serves two purposes: to protect Mildred if a
31 wall adapter with the wrong polarity is used (the wall adapter in this
32 case has switchable polarity, so it's always possible to make a
33 mistake); and to deliver 8.4V from a 9V wall adapter to lessen the heat
34 on the 7805 (since it only needs 8V in to regulate 5V out - anything
35 above that is just wasted.) There are also a couple of capacitors around
36 the 7805 intended to smooth out any power spikes to the board, and a red
37 LED indicating power-on.
38
39 ### Clock
40
41 The clock is a 6MHZ crystal oscillator circuit fashioned out of a 6MHZ
42 crystal, some small capacitors and resistors, and 3/4 of a 74LS00 chip.
43 References: based largely on design \#3 on [this
44 page](http://www.z80.info/uexosc.htm) and design \#13 on [this
45 page](http://www.geocities.com/dsaproject/electronics/cook-book/cook_book_11_20.html).
46 The clock drives the CPU, which in turn drives everything else. The
47 clock should probably be jumpered to make debugging easier.
48
49 ### CPU
50
51 The CPU is a Z84000. This processor is essentially a Z80, and is being
52 treated as such in Mildred. It has an 8-bit data bus and a 16-bit
53 address bus. To keep things simple, interrupts, bus requests, and
54 dynamic RAM refresh are not used.
55
56 ### Reset Mechanism
57
58 Currently, Mildred must be manually reset after power-on by the reset
59 switch (which simply grounds the /RST line of the Z80.) Ideally, a
60 DS1223 reset circuit would be used as to consume neglible real estate on
61 the board.
62
63 ### Address Decoding
64
65 The address decoding circuit is very simple - it uses a single 74LS32 to
66 determine the chip select signals `/LOMEM, /HIMEM, /IORD`, and `/IOWR`
67 based on the `/RD, /WR, /MREQ, /IOREQ, A15`, and `/A15` lines from the
68 CPU. (Actually, `/A15` is generated by the remaining 1/4 of the 74LS00
69 used for the clock.)
70
71 ### Memory
72
73 Mildred's read-only memory consists of a single 2864 EEPROM which can
74 store up to 64 kilobits (8 kilobytes) of data. Like all chips on the
75 board, it is socketed so that it can be extracted and reprogrammed.
76 (Note: Mildred should have been given a good quality socket here, it
77 would have saved many moments of frustration.) Since it is selected by
78 /LOMEM, the 2864 resides at memory locations 0000-1FFF and is mirrored
79 at 2000-3FFF, 4000-5FFF, and 6000-7FFF. It could also eventually be
80 replaced by a 27256 32K EPROM for larger programs (and would then occupy
81 0000-7FFF).
82
83 Given that EEPROM is very slow to write to, and that it has a limit to
84 the total number of possible writes that can be made to it, it is not
85 write-enabled in Mildred and therefore acts as ROM. This may however
86 change in the future, to allow Mildred to become an EEPROM programmer.
87 The risk is that an accidental loop (or a messy power-down condition w/o
88 the DS1223) could munge boot code. Therefore, /WR should probably be
89 jumpered at the 2864.
90
91 Mildred's RAM consists of a single 55256 (although its socket is not
92 fully wired yet.) This chip is 32 kilobytes of fast (15 ns!) static RAM.
93 It allows programs to incorporate a heap, or a stack, etc, and should
94 make it possible to run more sophisticated programs. It also puts the
95 address decoding circuit to better use. It is selected by /HIMEM and
96 thus occupies memory locations 8000-FFFF.
97
98 ### I/O Interface
99
100 The external interface connector is a 40-pin IDC header which is not yet
101 connected. /MEMRQ, /IORQ, /RD, /WR, /IORD, /IOWR, the 8-line data bus
102 and at least the lowest 8 lines of the address bus (eventually, probably
103 all 16) will be brought down to it, so that an I/O board and/or
104 diagnostic equipment, may be attached to Mildred.
105
106 I/O device decoding would reside on the I/O board and would probably
107 consist of two 74LS138's, enabled by /IORD and /IOWR, and driven by A5,
108 A6, and A7, selecting one of eight input and eight output devices.
109
110 Block Diagram
111 -------------
112
113 ![Block Diagram of Mildred](doc/mildred.png)
114
115 Testing
116 -------
117
118 - Construct power supply and test output voltage. Result: multimeter
119 reads 5.00V +/- 0.01V between output of 7805 and ground.
120 - Construct clock and test frequency. Result: multimeter reads 6.00
121 MHz +/- 0.01MHz between clock and ground.
122 - Construct CPU and EEPROM sockets and decoding logic, wire busses,
123 plug in CPU and test. Result: CPU operation seems normal. At one
124 point supply voltage to CPU measures 5.5V for unknown reason, but
125 problem seems to fix itself momentarily (Hail Eris).
126 - Program EEPROM with test program (in this case, using dipswitches
127 and LEDs on a breadboard):
128
129 0000: OUT (0), A
130 0002: JP 0000
131
132 - Run program and watch /IOWR line. Result: programming seems fine
133 (address lines conform to what would be expected for
134 instruction fetches) but /IOWR fails to strobe. Diagnosis: After
135 several re-programming attempts and diagnosis (using LEDs and a slow
136 clock as a makeshift logic probe) problem is discovered: two inputs
137 to the 75LS32 chip were mistakenly swapped. Solution: desolder and
138 resolder swapped lines. /IOWR strobes fine at 120 Hz.
139 - Attempt to run test program at higher clock speed. Result: again,
140 address lines strobe OK but /IOWR and /IORQ don't even budge.
141 Diagnosis: makeshift slow clock (4093-based) is not producing a 50%
142 duty cycle. Solution: Replace with 4011-based oscillator. /IOWR now
143 strobes fine up to \~5 MHz.
144 - Attempt to run at higest clock speed (from internal 6MHz
145 crystal oscillator.) Result: once again, address lines are OK but
146 not a peep from /IOWR or /IORQ. Diagnosis: Crystal oscillator is not
147 driving hard enough. Solution: add 470 ohm pullup resistor from
148 output to oscillator to +5V. /IOWR now strobes fine at 286 KHz.
149 - Construct RAM.
150