The 1802
Membership Card

For me and you and the 1802

by Lee Hart
 814 8th Ave N
Sartell MN 56377
leeahart@earthlink.net
last revised: 1/23/2011

What the heck is this? It's an adventure, by cracky! The "Membership Card" is your ticket to the weird and wonderful world of  microcomputing. Our guide will be the COSMAC 1802, perhaps the oddest and most entertaining microprocessor yet invented. I hope you will find this manual to be equally odd and entertaining.

The COSMAC 1802 was created in the 1970's at the dawn of the microcomputer revolution, by Joseph Weisbecker of RCA Corporation. It used their new CMOS fabrication process, which had very low power consumption, high noise immunity, and was very simple to use. It was intended for military and aerospace; applications too tough for other microcomputers to survive.

But Joe was a hacker at heart. He wrote a series of articles starting in the August 1976 issue of Popular Electronics magazine called "Build the COSMAC ELF". It described a simple low-cost computer, using the 1802 microprocessor. At the time, microcomputer systems cost hundreds to thousands of dollars. (Hmm... they still do today!) But Weisbecker's ELF cost less than $100! Yet, it was an honest-to-goodness real live computer, able to do anything its much bigger cousins could do -- albeit a bit slower and cruder.

It was the ideal computer trainer. Hobbyists built thousands of ELFs, learning about computer design, construction, and programming in the process. A dozen companies began producing versions of the ELF, also selling for low prices. It was the "Legos" of computers; a simple building block computer that could be assembled many ways to become almost anything, limited only by your imagination.

I learned about computing on my ELF. It set me on a career in engineering, as it did for thousands of others. 1802's got designed into all sorts of amazing things; video games, music synthesizers, Chrysler engine computers, military weapon systems, and even NASA missions such as the Galileo spacecraft. Eat stardust, x86 PCs!

So return with me now to those thrilling days of yesteryear, when the heroic pioneers of the microcomputer revolution learned how to build their own computers from scratch, and programmed them to do incredible things, all for a tiny amount of money!

So what can you do with an 1802?

The Membership Card is much like the Parallax BASIC Stamps; you can program it to do simple tasks, and serve as the "brains" of various projects. It can blink lights, drive relays or small motors, run displays, make annoying sounds with a small speaker, read switches or sensors to measure things, perform calculations, make decisions, and more. Its machine language is very simple, or there are BASIC interpreters and C compilers for the 1802 that can be downloaded free to write and run really ambitious programs.

Once a program is loaded, it can be retained without power for a short time by the onboard supercapacitor, or kept forever by maintaining power. Remember, this is a low power computer; it will run for a year on three AA cells!

The Front Panel board can be unplugged, and the Membership Card used by itself. In this case, simply connect the desired input and output devices to the 30-pin header directly. The Front Panel board isn't needed until you want to change the program, or debug or observe operation.

Specifications: What have we got here?

The Membership Card is a miniature copy of the original PopTronics ELF, built using modern parts and repackaged to fit in an Altoids tin. It's got the basics of every computer; a CPU, memory, and I/O.

CPU:	RCA CDP1802ACE microprocessor (the brains of the outfit)
	clock: RC oscillator, adjustable from 10-500 KHz (that's KiloHertz; not Mega- or GigaHertz)
Memory:	2k to 32k bytes, RAM or EPROM (that's kilobytes, not megabytes)
	supercapacitor holds data and programs in RAM without power
I/O:	one 8-bit output port, with LEDs
	one 8-bit input port, with switches
	one 1-bit output, with LED
	four 1-bit flag inputs, one with a pushbutton switch
	one interrupt input
Connectors: 4-pin power connector (+V, -V, +RUN, -LED enable)
	25-pin DB25 connector with all the I/O on it
	DB25 can plug into a PC parallel port to operate the Membership Card with the PC
Size:	3-1/2" x 2-1/8" x 3/4" (89 x 54 x 19 mm)
Power:	voltage: 2.5-5.5vdc
	current: 0.1 to 1ma (depending on clock speed and supply voltage)
	plus 1-3ma for each LED that is on
Aroma:	a hint of curiously strong peppermint

Unlike modern microcomputers that require an expensive PC and huge software programs to do anything, the Membership Card is totally self-sufficient. No PC is needed, and no special software is required. You can power it from a few AA cells or a scrapped calculator solar panel, and program it with nothing but the front panel switches and lights. If you ever get stranded on a desert island and need to compute, this is the computer to have in your pocket.

Assembly: Getting it all together

This ain't no Heathkit, but I'm working to make it as easy to build as possible. I want it to be something you can give to your kids, and have them experience the thrill of saying "I did it! It's alive! Bwoo hah hah hah..."

To assemble it, you'll need the following tools:

 - A clean, well-lit, place to work. Preferably one without cats or small children.
	Or if the kids are old enough, let them help. (Cats never get old enough to help.)
 - Soldering iron with a small tip. Don't use a soldering gun unless you're desperate;
	soldering these tiny parts and pads with a fat tip will be a real challenge.
 - Solder. 63/37 tin/lead is best, but 60/40 is also good. Lead-free electronics solder is
	also OK, though it doesn't solder as well. It must be rosin core electronics solder;
	NOT acid core plumbing or sheet metal solder!
 - Wire cutters. The smaller the better. Nothing is big here.
 - Needle-nosed pliers. For bending or straightening lead wires, holding nuts, etc.
 - Screwdriver with a 1/8" wide or smaller blade. For tightening mounting screws and
	adjusting the clock frequency pot.
 - A magnifying glass. My old eyeballs aren't good enough to read the markings on some
	of the parts, or see whether a solder joint is done right or is shorted to the pad
	next to it. Your eyes may not be that good, either.

You'll need to know how to solder. This isn't the right kit to learn how to solder on. The pads are pretty small, and if you make a mistake, it can be a real bear to get the part off and put back on the right way.

First, make sure you have all the parts. I supplied everything that goes on the printed circuit board, but you may need to gather a few other things yourself. I'll supply Altoids tins as long as my supply holds out (not long), but you will have to drill or cut the holes in it for the switches, LEDs and connectors.

The Membership Card is your entry into the COSMAC College of Computer Knowledge. We'll start with an aptitude test. See if you can find and identify the common electronic components listed on the next page. Place a check mark in the box (  X  ) as you find them. If any are missing, let me know so I can send it out before you get bored and go back to watching TV. Ready? Turn the page to begin an adventure that could last a lifetime...

Parts List

    Quantity	Identifier	                        Description	Source
(    )	1	C1	capacitor, 22pF NPO ceramic (yellow, marked 22)	Jameco 332541
(    )	4	C2-4,7	capacitor, 0.1uF X7R ceramic (yellow, marked 104)	Jameco 544868
(    )	1	C5	supercapacitor, 0.047F, 5.5vdc (green, 0.5" dia.)
(    )	1	C6	capacitor, 100pF ceramic (yellow, marked 101K)	Jameco 81525
(    )	9	D0-8	LED, T1-3/4, red	Jameco 697611
(    )	2	D9,10	diode, 1N4148	Jameco 36038
(    )	1	D11	diode, 1N5231B 5.1v zener (standard)	Jameco 179047
			or 1N4625 5.1v zener (optional; lower power)
(    )	1	J1	30-pin header, 0.025" sq.pins on 0.1" centers	Jameco 103342
(    )	1	J2	25-pin connector, DB25F female, vertical PC mount	Jameco 15165
(    )	3	P1a,b,c	10-pin top entry socket, Molex 22-18-2101	Digikey WM3241-ND
(    )	1	P2	5-pin header, 0.025" sq.pins on 0.1" centers	Jameco 2076789
(    )	1	P3	4x2 pin header, 0.025" sq.pins on 0.1" centers	Jameco 109516
(    )	1	P4	4 pin header, 0.025" sq.pins on 0.1" centers	Jameco 117560
(    )	1	Q1	MOSFET, 2N7000 or VN2222 (3 leads, black)	Jameco 119423
(    )	1	R1	1meg trimpot, Bourns 3266W (3 leads, blue cube)	Jameco 254749
(    )	1	R2	resistor, 15k 5% 1/4w (brown-green-orange-gold)	Jameco 691147
(    )	2	R3,6	resistor, 100k 5% 1/4w (brown-black-yellow-gold)	Jameco 691340
(    )	4	R4,8-10	resistor, 499k 1% 1/4w (yellow-white-white-orange-brown)  Jameco 691500
(    )	1	R5	100k 9-pin SIP, 8x100k (yellow body)	Mouser 652-4609X-1LF-100K
(    )	1	R7	resistor, 1meg 5% 1/4w (brown-black-green-gold)	Jameco 691585
(    )	1	R11	1k 10-pin SIP, 9x1k (green body)	Jameco 97877
(    )	2	R12,13	100k 8-pin SIP, 7x100k (black body)	Jameco 276358
(    )	11	S0-10	subminiature toggle switch, SPDT	Digikey CKN1059-ND
(    )	1	S11	subminiature pushbutton switch, SPDT	Digikey CKN1740-ND
(    )	1	U1	1802 microprocessor
(    )	40		40 socket pins (or low-profile IC socket) for U1	(Mouser 575-393640)
(    )	1	U2	RAM; 6116 (2k), 6264 (8k), or 62256 (32k)
			(or EPROM; 2716-27256 or 27C16-27C256; 2k-32k)
(    )	28		28 socket pins (or low-profile IC socket) for U2	(Mouser 575-393628)
(    )	1	U3	74HC373 or 74HCT373 octal latch	Jameco 45831
(    )	1	U4	4093 quad 2-input NAND	Jameco 13400
(    )	1	U5	4013 dual D flip-flop	Jameco 893443
(    )	1	U6	74HC244 or 74AHCT244 octal buffer	Jameco 45655
(    )	1	U7	74HC374 or 74HCT374 octal D flip-flop	Jameco 45858
(    )	1	U8	4071 quad 2-input OR	Jameco 13274
(    )	1	U9	74HC257 quad data selector	Jameco 45719
(    )	1		"Altoids" tin candy box
(    )	1		insulating paper sheet, 3-1/2" x 2-1/8"
(    )	2		#4 mounting hardware for DB25F connector
(    )	4		jumpers for P2 and P3 headers

Did you find them all? Here are some hints:

Comments on components

The resistors use colored rings to identify their resistance. The other parts have numbers, but you may need a magnifying glass to read them. Capacitors have their value in Farads (usually picoFarad). For example, "22" is 22pF (22 picoFarad). "101" is 10 with one zero after it, i.e. 100pF. "104" is 10 with 4 zeroes after it pF; that's 100,000pF = 0.1uF (microFarad).  

ICs have room for a part number, but it's hidden between extra letters (the 1802 is CDP1802ACE). Leave the ICs in their tubes until you are ready to install them. They are easily damaged by static electricity. You know that teeny little spark you get if you touch something metal after petting the cat or walking across a carpet? That's static electricity. To the microscopic world inside an IC, it hits like a lightning strike. Boom! Your IC is dead.

Assembly

Assembly is a work in process. I'll just describe how I built mine. Please let me know if you find better ways to do it! Check off the steps as you go ( X ), in case you get interrupted and have to come back to it later.

A couple things to keep in mind: To fit both boards in an Altoids tin, they must be built with the parts as low as possible. Standard  IC sockets are too high, so I've supplied special low-profile socket pins. Likewise, the plastic body of the 0.025" square pin headers (J1, P2-4) is too tall, so they have to be removed after soldering. You'll also need to trim the leads on the back sides of the boards very short as you go.

Ready? Let's get started!

Separate the boards

(    )	Cut the boards apart. The Membership Card and Front Panel boards are made in one piece to reduce cost. Cut on the white line with a hacksaw or equivalent fine-toothed saw.

	I put mine in a vice, with the line to cut at the top of the vice's jaws. I then cut on the line with a hacksaw, held parallel to the board (cutting across it, not through it). This makes a much straighter and cleaner cut. Be careful not to cut into any of the holes or traces! Clean up any rough edges with a file or sandpaper.

Membership Card assembly

All parts go on the side of the board with the white silkscreened lettering (the top or "component side"). All soldering is done on the other side (the back or "solder" side). The only exception is for P1a, b, and c (I'll remind you when we get to it).

(    )	Find C1; a 22 pF ceramic capacitor (yellow body, labelled "22" or "22K"). Straighten the leads if necessary with your needle-nosed pliers. Insert the leads into the holes on the board in the box at the location marked "C1". Bend the leads outward slightly to hold it on the board. Turn the board over, and solder each lead. Cut off the excess lead length.

Now repeat this proceedure for the rest of the capacitors.

(    )	C2: 0.1uF (yellow, marked "104").
(    )	C3: 0.1uF (yellow, marked "104").
(    )	C4: 0.1uF (yellow, marked "104").
(    )	C6: 100pF (yellow, marked "101" or "101K").

(    )	C5: 0.047F (green, marked "0.047F"). Two black stripes mark the negative side. The pin next to the black stripes must go in the hole in the board by the "-" sign. Bend the leads slightly to hold it in place, then solder the leads, and cut off the excess.

Now for the resistors:

(    )	Find R1; it's a 1 megohm trimpot (a little blue cube with 3 leads, marked "W105"). Put it at location "R1", bend the leads to hold it, solder them, and cut off the excess.

(    )	Find R2; a 15k ohm 5% resistor (color bands are brown-green-orange-gold). Bend the leads close to the body. Insert the leads into the holes on the board at the location marked "R2". Bend the leads outward slightly to hold it, solder each lead, and cut off the excess.

Repeat this proceedure for the rest of the resistors.

(    )	R3: 100k 5% (brown-black-yellow-gold).
(    )	R4: 499k 1% (yellow-white-white-orange-brown).
(    )	R6: 100k 5% (brown-black-yellow-gold).
(    )	R7: 1 meg 5% (brown-black-green-gold).

(    )	R5: This is a 9-pin SIP (Single Inline Plastic) package with eight 100k resistors in it (yellow, marked "9X-1-104LF"). Note the end with the black dot or line; this is "pin 1". Place it on the board at location R5 with the pin 1 end next to C4. Bend two of the leads slightly to hold it in place, then solder each lead, and cut off the excess.

Diodes: They are polarity sensitive, and have a black band at one end. Be sure the banded end matches the band shown on the board!

(    )	D9: 1N4148 (a reddish glass tube, with a wire at each end, and "1N4148" printed on it in tiny letters). Bend the leads, and place it on the board at "D9" with the banded end as shown on the board. Solder each lead, and cut off the excess.
(    )	D10: 1N4148. Install it the same as D9.
(    )	D11: 1N5231B. Install the same as D9 and D10.

IC socket pins (or sockets): You have some choices here. Ideally, you don't need sockets or socket pins; they add cost, make the board higher, and a little less reliable (sockets will be the least reliable part of the whole computer). But having them makes troubleshooting and chip replacements easier.

(    )	U1: 1802 integrated circuit. I supplied socket pins, which require some fussy work. They have an extremely low profile, but are tiny and easy to lose! Push a socket pin onto each pin of the 1802 IC. Put the 1802 with socket pins on the board, and then solder all the pins. Do not use too much solder, or it will solder the IC to the board! If you do it right, the 1802 can be unplugged from the board just like an IC in a socket. Do not cut the socket pins! The bottom needs to remain closed so solder won't get inside.

	If you want to use your own IC socket, place it at location "U1" with the end with the notch matching the one shown on the board. Solder each pin, and cut off the excess. Install the 1802 in the socket (with pin 1 at the correct end).

(    )	U2: memory chip (could be a RAM or EPROM, from 2k to 32k bytes). Install as described for U1 above.

Now let's do the rest of the ICs. I did not supply sockets or socket pins for them. They are not likely to fail, and the sockets cost more than the chips. You can add sockets if you like, but it is likely to increase the height.

ICs are polarity sensitive; they must be installed with the pin 1 end matching the marking on the board. The pin 1 end may be marked in a number of ways; with a dot, notch, or line, etc. When the writing on the IC is right side up and facing you, pin 1 is at the lower left corner. See the illustration on page 6 to find pin 1.

For each IC, make sure its pins are straight and parallel to each other so it fits into the holes on the board. If they are bent slightly, straighten them with your needle nosed pliers.

(    )	U3: 74HC373 (or 74HCT373) 20-pin IC. Install at U3, and bend a couple pins slightly if necessary to hold it in place. Be sure pin 1 is at the correct end! Then solder all pins, and cut off the excess.
(    )	U4:  4093 14-pin IC. Install the same as for U3.
(    )	U5:  4013 14-pin IC.
(    )	U6:  74HC244 (or 74AHCT244) 20-pin IC.
(    )	U7:  74HC374 (or 74HCT374) 20-pin IC.

We're almost done. Now for the pin headers.

(    )	J1: 30-pin header. The little square pins are held by a black plastic body. If you don't plan to put the boards in an Altoids tin, just put the header on the board, and solder it in place.
	
	If you DO want it to fit in an Altoids tin, the plastic body must be removed. Here's how I did it:

	- Put the pin header loosely in a small vice, with the plastic body sitting on top of the jaws.
	- Pound the short end of each pin into the plastic, so all of the pin sticks out the other side.
	- Insert the pin header from the BACK side of the board, with the plastic body about 1/8"
	   away from the bottom of the board (so the pins stick up about 1/4" above the top of the board).
	- Solder each pin from the TOP side of the board.
	- Cut each pin on the BACK side of the board. This also removes the black plastic body.

(    )	P2: 5-pin header. Mount P2 the same as above. The pins must not stick up more than 1/4" above the board.

(    )	P3: 6-pin header. I supplied an 8-pin part. Remove two of the pins so it will fit on the board. Then mount the same as J1 and P2. The pins must not stick up more than 1/4" or they will short to the Front Panel board.

(    )	Q1: MOSFET transistor (2N7000). This is also a static sensitive part, so beware of static electricity. Position the flat side of the body to match the outline on the board. Put each lead in its respective hole. Solder Q1 and cut off the excess lead length.

Front Panel assembly

(    )	Use the bare front panel board as a template for drilling your front panel (an Altoids tin, or your own plastic or metal case). Drill small 1/32" guide holes for the switches, LEDs, D-connector mounting holes, and 4-pin power connector P4. Then remove the PC board, and drill the holes to their final sizes. Use a "step" drill bit, which won't tear the very thin metal of an Altoids box (this is a long drill bit with a single cutting edge that has steps in it to drill a dozen or so sizes of holes from 1/8" to 1/2"). The D-connector opening will have to be cut out with a nibbler or a lot of hand filing.

(    )	D0-D8: Place the LEDs in their holes on the board, with the flat side left (toward the edge with the D-connector). DO NOT SOLDER THEM YET. You can bend the leads so they won't fall off.

(    )	J2: Temporarily attach the D-connector to the front panel with #4 hardware. The side with the most pins goes toward the top (to match the silkscreen on the PC board).

(    )	Now, fit the PC board with the LEDs and switches into the holes in your front panel. Work the board down as close as possible to the metal panel. This forces all the parts into the correct positions to match your front panel holes. Careful! The switches can break if your front panel holes don't match the board well enough. NOW solder the parts to the board, with the front panel holding them all in position.

(    )	Remove the screws from the D-connector. Remove the PC board from the panel, so you can install the rest of the parts. The above may seem tedious, but it guarantees that the parts will be soldered in the right position to match the holes in your front panel.

(    )	P1a, b, c: Mount these connectors on the BOTTOM of the Front Panel board. Three 10-pin parts are supplied, as I couldn't find a single 30-pin part. The two "feet" point to the center of the board. Cut off these feet after the connector is mounted.

(    )	R11: 10-pin SIP resistor network with nine 1K resistors (green, marked "Dale 1-102G"). Note the end with the black dot or line; this is "pin 1". It goes on the LEFT end, toward the center of the board and in the hole with the square solder pad. Solder each lead and cut off the excess.

Install R12 and R13 exactly the same as R11:

(    )	R12: 8-pin SIP with seven 100K resistors (black, marked "8X-1-104").
(    )	R13: 8-pin SIP with seven 100K resistors (black, marked "8X-1-104").

Install the fixed resistors and capacitor as was done on the Membership Card:

(    )	R8: 499k 1% (yellow-white-white-orange-brown).
(    )	R9: 499k 1% (yellow-white-white-orange-brown).
(    )	R10: 499k 1% (yellow-white-white-orange-brown).
(    )	C7: 0.1uF (yellow, marked "104").

Install the ICs the same as U3-U7 on the Membership Card. Be sure pin 1 is as shown on the board: 

(    )	U8:  4071 14-pin IC.
(    )	U9:  74HC257 16-pin IC.
(    )	P4: 4-pin header. Install as described for J1 on the Membership Card. Or if you prefer, leave off P4 and solder 4 small wires to the board instead, with a connector on the other end.

(    )	Check to see that the finished board still fits into the holes in your front panel. You may have to re-heat and reposition some parts, or enlarge some holes in your front panel to make it fit easily.

(    )	Cut the piece of "fish paper" (electrical insulating paper) to just fit in the bottom of the Altoids box. It prevents the pins on the back of the board from shorting to the metal case.

Final Assembly

(    )	Plug the Membership and Front Panel boards together. Look between them for any places where parts touch each other and could cause a short. Trim any leads that are too long and might touch.

(    )	I don't have enough nuts for all the switches, and haven't found a place to buy them; so I only supplied 4 sets. That's OK; they are spaced so closely that you can't put nuts on adjacent switches anyway. Just use nuts on the end switches in each row. Don't bother with the washers; there is no room for them.

Next, you need to install jumpers on the Membership Card to configure it for the particular size and type of memory chip installed at U2:

(    )	P2 and P3: Look at the type of memory chip installed at U2. Ignore the letters at the beginning and end of the part number, and focus on the 4-digit or 5-digit number in the center. For example, suppose it's marked "HM62256P-12" -- then it's a 62256 (a 32k byte RAM).

(    )	Find the table at the bottom left corner of the schematic. Look up your chip number to see what jumpers to install. For a 65256 for example, install jumpers at P2 between pins 1-2 and 4-5, and at P3 between pins 1-3 and 2-4.

Operation

The Front Panel selects the 1802's operating mode and shows its status. The eight Data switches S7-S0 set the data to be input. S12 is the IN pushbutton; pressing it loads the data. Data LEDs D7-D0 display the data last loaded or output by the 1802 program. LED D8 shows the status of the 1802's "Q" register.

S8 is the READ/WRITE switch; it controls whether you can read or write to memory. S9 and S10 are the mode switches, CLEAR and LOAD. They select the four operating modes as follows:

	S9	S10
Mode	CLEAR	LOAD	1802 Operation
LOAD	down	down	Waits for the next memory read/write (next press of the IN button).
CLEAR	down	up	Reset the 1802 (sets registers Q, X, P, and R0 all to 0).
WAIT	up	down	Pause; stops the program in memory, and waits right where it is.
RUN	up	up	Run the program in memory.

Here's an example of how these switches and lights work.

1.	Power up the card. Set switches S11-S0 as shown. "1" means the switch is up. "0" means the switch is down. "X" means push the button. "." means the switch state doesn't matter. I'll show the switch positions like this:

	Switch numbers and positions on the board
	  S11	S10	S9	S8	S7	S6	S5	S4	S3	S2	S1	S0	Mode	Description
	.	1	0	.	.	.	.	.	.	.	.	.	CLEAR	Resets the 1802.

PROGRAM 1 -- BLINK Q FAST			Let's load a simple program to blink the "Q" LED:

	  S11	S10	S9	S8	S7	S6	S5	S4	S3	S2	S1	S0	Mode	Description
2.	.	1	0	.	.	.	.	.	.	.	.	.	CLEAR	Reset the 1802 (sets R0 to address 0000).
3.	.	1	0	1	.	.	.	.	.	.	.	.	WRITE	Set S8 up, so we can write to memory.
4.	.	0	0	1	.	.	.	.	.	.	.	.	LOAD	Set both S9 and S10 down.
	X	0	0	1	0	1	1	1	1	0	1	1	a.	Set S7-S0 to "0111 1011", then press the IN button.
					  \__7__/	  \__B__/		This loads hex 7B ("Set Q" instruction) into memory address 0000, displays it in the LEDs, then advances R0 from address 0000 to 0001.
	X	0	0	1	0	1	1	1	1	0	1	0	b.	Set S7-S0 to "0111 1010", then press IN. This loads
					  \__7__/	  \__A__/		hex 7A ("Reset Q") into 0001, displays it, then advances R0 to 0002.
	X	0	0	1	0	0	1	1	0	0	0	0	c.	Set S7-S0 to "0011 0000", then press IN. Loads hex 30 
					  \__3__/	  \__0__/		(Branch Unconditional") into 0002, displays it, then advances R0 to 0003.
	X	0	0	1	0	0	0	0	0	0	0	0	d.	Set S7-S0 to "0000 0000", then press IN. Loads hex 00
					  \__0__/	  \__0__/		(tells Branch Unconditional" where to jump to; in this case, back to 0), displays it, then advances R0 to 0004.

Our program is loaded. Let's read it back to see if it's correct.

	  S11	S10	S9	S8	S7	S6	S5	S4	S3	S2	S1	S0	Mode	Description
5.	.	1	0	.	.	.	.	.	.	.	.	.	CLEAR	Reset the 1802 (sets R0 to address 0000).
6.	.	1	0	0	.	.	.	.	.	.	.	.	READ	Set S8 down, so we can read memory.
7.	.	0	0	0	.	.	.	.	.	.	.	.	LOAD	Set both S9 and S10 down.
	X	0	0	0	0	1	1	1	1	0	1	1	a.	Press the IN button. This reads memory address 0000,
					  \__7__/	  \__B__/		displays its contents in the LEDs ("0111 1011", which is hex 7B) then advances R0 from address 0000 to 0001.
	X	0	0	0	0	1	1	1	1	0	1	0	b.	Press IN again. Displays "0111 1010" = hex 7A from
					  \__7__/	  \__A__/		address 0001, then advances R0 from 0001 to 0002.

	X	0	0	0	0	0	1	1	0	0	0	0	c.	Press IN again. Displays "0011 0000" = hex 30 from
					  \__3__/	  \__0__/		address 0002, then advances R0 to 0003.

	X	0	0	0	0	0	0	0	0	0	0	0	c.	Press IN again. Displays "0000 0000" = hex 00 from
					  \__0__/	  \__0__/		address 0003, then advances to 0004.

If our program is correct, now we can run it!

8.	.	1	0	.	.	.	.	.	.	.	.	.	CLEAR	Reset the 1802 (set R0 back to address 0000).
9.	.	1	1	.	.	.	.	.	.	.	.	.	RUN	Both S9 and S10 up. The 1802 begins running the program starting at address 0000.

This program is very simple; it tells the 1802 to turn the Q LED on, then turn Q off, then repeat forever. But it's doing it so fast that the LED looks half on. To prove it's really going on and off, we can use the WAIT mode to temporarily stop the program, and then resume again.

10.	.	0	1	.	.	.	.	.	.	.	.	.	WAIT	Stop right where you are. The 1802 "freezes" right where it is in the program. The Q LED might be caught on, or off.

By flipping S10 up and down, we can Run and Wait the program, sometimes catching Q on, and sometimes off. WAIT mode is handy for debugging, because you can check on the state of all the lines with a meter or logic probe to see what is going on.

Here's a little bit longer program to toggle in. It does the same thing (blinks Q), but does it far slower, so it's easy to see it blink on and off. Let's simplify the description so it's not so wordy. Use the same sequence of switch flipping as for the previous program; but this time the "machine code" (the sequence of numbers that the 1802 understands) are a little different, and longer. See if you can figure out how to enter it.

PROGRAM 2 -- BLINK Q SLOW		Blink the Q LED slowly.

memory	machine code	human readable
address	instructions	comments on what
(R0)	Hex	Binary	the instructions do
0000	7B	0111 1011	set Q
0001	FC	1111 1100	add...
0002	01	0000 0001	...1
0003	3A	0011 1010	branch if not zero...
0004	00	0000 0000 	...to address 0
0005	7A	0111 1010	reset Q
0006	FC	1111 1100	add...
0007	01	0000 0001	...1
0008	3A	0011 1010	branch if not zero...
0009	05	0000 0101	...to address 5
000A	30	0011 0000	branch unconditionally...
000B	00	0000 0000	...to address 0

The 1802 is an 8-bit microprocessor. 255 is the biggest number it can represent with 8 bits. The instructions from 0000 to 0004 are a loop; it counts up until it hits 255. Then, adding 1 to 255 makes it "roll over" back to 0 again. This satisfies the Branch instruction at 0003, so it stops looping and continues with the instruction at 0005.

This turns Q off, and then loops another 256 times until the counter rolls over again from 255 to 0. The final unconditional branch at 000A makes it start all over again. The result is that Q blinks slowly on/off about once a second (depending on the 1802's clock speed).

PROGRAM 3 -- READ SWITCHES AND DISPLAY IN LEDS

Here's a little more complicated program. It reads the 8 data switches, and displays their settings with the 8 LEDs. It tests the Membership Card's ability to read and write the switches and lights. Run it with S8 up (write).

address	instructions
(R0)	Hex	Binary	comments
0000	E1	1110 0001	set X=1
0001	90	1001 0000	set D=0 (copies the hex 00 from the high half of R0 into D)
0002	B1	1011 0001	set the high half of R1=D (so R1 is now 00 xx)
0003	F8	1111 1000	set D...
0004	10	0001 0000 	...=10 hex
0005	A1	1010 0001	set the low half of R1=D (so R1 is now 0010)
0006	6D	0110 1101	D and memory location R1 = input from port 5 (the front panel switches)
0007	65	0110 0101	output memory location R1 to port 5 (the front panel LEDs)
0008	30	0011 0000	branch unconditionally...
0009	00	0000 0000	...to address 0000

Last Writes

I'm still working on this manual. I plan to add better assembly directions, instructions for hookup and troubleshooting, and more programs to get you started. Longer term, I hope to get a program working that runs on a PC to operate the front panel without all that "flippin" switch flipping!

I hope what I have so far is enough to get you going. If not, please feel free to contact me with comments, corrections, questions, or ways to improve this project. My contact information is on the first page.

Silkscreen errors (I will fix these on later versions):

- The names for P1 and J1 on the schematic and silkscreen are reversed.
- The name IN5/IN7 should be IN4.
- The name OUT5/OUT7 should be OUT4.

Changes along the way:

July 2010: Changed R8-R10 from 100k to 470k.
Aug 2010: Rev.B board: Added Q1 and C6. Changed I/O port from 5 to 4. Move RUN to P4.
Nov 2010: Changed R4, R8-10 from 470k to 499k, and C6 from 82pf to 100pf (for expediency; I ran out of 470k and 82pf parts, and have lots of 499k and 100pf).

Links for more data on the 1802 and ELF computers:

http://www.ittybittycomputers.com/IttyBitty/ShortCor.htm
"A Short Course in Programming, by Tom Pittman. An excellent introduction to programming the 1802.
http://incolor.inebraska.com/bill_r/elf/html/elf-1-33.htm
This is the Aug 1976 Popular Electronics article that introduced the ELF to hobbyists. Much of it applies directly to the Membership Card.
http://www.cosmacelf.com
This is the COSMAC ELF "fan club" website, with lots of information on the many commercial and hobbyist variants.
http://www.retrotechnology.com/memship/memship.html
This is Herb Johnson's website on the Membership board. He built one of the first ones, and has done a great job of documenting it on his website. I'll be providing updates to the manual, software examples, etc. there.