Serial interface notes for 1802 Membership Card


Last updated May 24 2020. Edited by Herb Johnson, (c) Herb Johnson, except for content written by Mark Thomas, Lee Hart and others. This page supports serial hardware for (some versions of) Lee Hart's COSMAC 1802 "Membership Card". Here's a link to the home Web page for the "Membership Card" It has history, development, current status, and links to other documents. There's a link there to the Web page for the current available version of the Membership Card kit, and a link on how to order it.

Introduction

Old computers used serial interfaces to connect to "terminals" to run them. Serial was also a way to move data between computers, or to "talk" to computer-things like printers, modems, other devices for control and data transfer. The 1802 Membership Card is old in that way as well. Most people will operate it through a serial connection to a modern computer. There's many generations of the 1802 Membership Card, and the serial interface has evolved accordingly.

If you have a Rev J or later 1802 Membership card, or
If you want to operate an 1802 Membership Card CPU board alone:
... you likely want to operate it with a serial USB adapter to your modern computer. That linked Web page, discusses BASIC 3 & monitor in ROM (code available from Lee Hart's site) and an FTDI-chipped USB-to-TTL serial adapter for communications and power. If you have or want some other kind of USB-to-TTL adapter, well, see if that information gives you useful clues.

If you have a Rev G or later 1802 Membership Card, there's (also) a serial interface as part of the Front Panel card, through the DB-25 connector. For example, here's a link to Revision G of the M/S card. But follow the manual for your revision, please! This Web page (here!) discusses how to configure and test that serial interface. You have to be aware of how the serial interface you build, changes the "logic" of the serial signals. Also, the CPU clock speed must be set to maximum, as most COSMAC software assumes a 1.8 to 2MHz clock. This note and linked-to notes provide details.

To make an "RS-232" type serial connection as typical for old PC's with "serial ports", there's another Web page which describes a specific kit of parts. Those include a RAM, a ROM with the IDIOT monitor program (old RCA's UT4), DB25 and DB9 serial connectors and specific instructions for that purpose. Most any 1802 Membership Card kit can be operated in that way.

If you have a earlier-than Rev G 1802 Membership Card, discussion of external serial interfaces for those has been moved to another Web page. See this linked Web page for details of building serial interfaces for pre-Rev-G Membership cards. That information also has details about serial interfacing, which may be useful for adapting your interface for specific hardware and software.

Setting up the serial interface

Basic notes about the Membership Card's front-panel serial interface, are included in each revision's construction manual. Go to my 1802 MC "home page" for links to your specific-revision's support Web page. There's manuals and other information on that revision's Web page.

If you are using RS-232 or classic serial connections from a PC or terminal, consider those voltages are not the same as the Membership Card's "zero or five volts" logic signals. The PC's transmit will be several volts positive high and several volts NEGATIVE low. Recieve will expect at least four-five volts positive, and zero or a few volts negative. The "RS-232" feature of the Membership Card can borrow the PC's transmit signal to create that negative voltage for the Q's "transmit" signal.

Essential considerations of the front-panel serial interface

Serial interfaces are tough, because software and hardare of the 1970's (the ELF and the Membership Card) had lots of ways to "read" and "write" serial signals. When you add the 1980's of personal computers, and the 21st century USB, it's a lot of possibilities. Most of these shake down to getting the "logic of high and low" correct, getting the "baud rate" correct, and knowing your software. Here's a list of all the possibilities - just to put them on one page, don't be alarmed!

Do you need to invert the incoming serial recieve signal?
Do you need to invert the outgoing serial transmit signal?
Will you be connecting to a "RS-232" or "standard serial" device like a computer or terminal?
Will the software on your Membership Card, expect to operate EF3 for serial input?
What is the baud rate, data bits, mark/space/parity, stop, needed for your 1802 software?
[Your external software or terminal must use the same baudrate, bits, etc. as your 1802 software]
[All 1802 serial software expects to use Q as serial output.]
Do you know that EF1, EF2, EF3, EF4 - are all "active low" inputs?
This linked Web page about building a serial interface for previous Membership Cards discusses some of these terms and considerations.

Some of the above also apply to "USB to serial" adapters. They may also have "TTL" type connections instead of "RS-232" connections. "TTL" is another way to describe the zero volt/five volt logic of the Membership Card.

Here's what I mean by "EF3 is active low". Note that all the EF inputs on the 1802 CPU chip, are inverting or active low. That means, programmatically, that for the "/EF3" pin on the 1802 CPU, the B3 instruction branches when the "/EF3" pin is LOW, which the processor sees as EF3 is a "1". Electronic schematics show "active low" signals with a preceeding "slash", or a horizontal line over the letters describing the signal.

This is a long list, but it amounts to sorting out the serial features of an 1802 program, the hardware on your 1802 Membership Card, and the features of the serial device(s) you are connecting to. That's how it was done in the 20th century. The 21st century replaced all this with "plug and play" "USB" "networking" - which isolates you from knowing how things really work.

Testing a serial interface

A serial interface for the Membership Card, can be tested in a few ways. Here's a brief descripion about testing. For more details on these tests, examine these detailed notes. - Herb Johnson

1) A simple toggle-in program loop, can read /EF3 and send the result (or the compliment, inversion of it) immediately to Q to write it out. If you connect your Membership Card serial interface to a terminal program on a computer, you "should" be able to send text to the M/S card and have it "echo" that text back. Such a program, is called a software loopback.

This program won't care (much) about baud rate because the loop is fast enough to sample many baud-clock cycles. See the simple serial loopback programs in the M/S card "test software" Web page. Keep in mind two things: first, your hardware interface on EF3 and Q may or may not be "inverting" the serial signal. Second, EF3 is "active low", the branch-on instructions test the inverted logic value of the signal on the "/EF3" pin. Figure this out as you use one of the two programs - they are only several bytes long.

2) You might monitor the actual Q and /EF3 signals, on the 30-pin connector edge of the front-panel card. An oscilloscope is the best monitor. Without that instrument, at manual speeds you can wire up an LED with a series resistor (500 ohms to 1K ohms) connected to Vcc (power). That probe will "light" when the "probe" is connected to ground. So a low signal should also light the LED. Here's a note on a more elaborate logic probe.

2) You can also run the "toggle Q slowly" program with the Q circuit "loopback" connected to the EF3 circuit, and probe the Q and EF3 interface circuits accordingly. That's called a local loopback test. Follow the "logic" and see if you understand what's going on.

3) Also: you may want to monitor the serial or RS-232 signals from your PC computer. An LED probe for that, may need a larger resistor, a few K ohms, because of higher voltages. Some serial "adapters" include LEDs to monitor the serial lines. Some of them have two-color LED's, connected "backwards", so one lights for positive voltage (often RED) and one for negative (often GREEN).

Here's more detailed notes about these tests and the serial interface for Rev G and later. - Herb Johnson

Bottom line: By playing with the toggle-in loopback and toggle-Q programs, probing your interface, and watching the results, you'll learn how the 1802 deals with inputs and outputs. Working with other programs and baud rates, teaches you about serial interfaces. That's an entry into computer control, networking and interfacing. That's how we learned those things in the 20th century.

Q LED and serial: by Lee Hart.

Lee: "An interesting quirk: Q=1 lights the red LED, and EF3=1 lights the green LED. So you would think that both would light in this loop test, and you'd see yellow. But both LEDs share the same series resistor, and the green LED has a higher forward voltage drop. This means you don't see the green LED; D8 just lights up red. To see green, you can [disconnect your serial external connections and] jumper DB25 pin 20 to power or ground while Q=0."

"When you are feeding in TTL or RS-232 data whose high-state voltage is greater than the Membership Card's supply, then the green does light even if the red is lit."

"You can also enter a trivial program to check EF3, and set Q to the opposite state. Then the LED lights either red or green, depending on the logic level at RXD (DB25 pin 20). This proves that both EF3 and Q and the LED circuits all work." - Lee Hart

Setting the CPU clock trimpot

The clock circuit trimpot must be set at almost the fastest end of its range. Turn the trimppot counter-clockwise until you here a "click". You can turn past it a few times, to find the point just when it clicks. Then, turn it clockwise about 3/4 of a turn, or 7/8 of a turn. That gives you both the highest frequency and a more square clock waveform. If you go past about one turn, the frequency drops rapidly. If you go less than half a turn, the waveform gets "unsquare" and is of smaller voltage.

To "see" the frequency: If you can attach an oscilloscope to the clock, you'll see the clock waveform get "longer" as you turn clockwise too far. Or, if you have a frequency counter (some digital voltmeters have that feature), you will see the frequency at close to the resonator frequency, or drop rapidly if the trimpot is too far clockwise from its most counter-clockwise position.

Another way to tweak the trimpot: If you get a monitor like IDIOT running, you can tell the monitor to dump a large part of memory on the terminal screen. if you tweak the trimpot, at some point the screen will show "garbage"; turn it back or counter-clockwise to get proper characters again. Note: your terminal or terminal program may "lock up" if it thinks it sees certain "control characters" amongst the "garbage".

what is "clockwise"? Look it up, or look for an old non-digital clock with hands and watch it move "clockwise".

Faster CPU clocking; 1.8MHz vs 2.0Mhz resonator

Herb Johnson, April 2014: I'm running the IDIOT monitor with a 2.0MHz resonator at either 110, 300 or 1200 baud, 7 bits, mark or space parity, 1 stop bit. I also tried the 1.8MHz resonator supplied in the kit. There may be a baud rate problem at 1.8MHz and 1200 baud, but 300 baud worked OK. The original IDIOT monitor (and its EF4 predecessor) ran on a 2.0MHz COSMAC. So did Lee Hart's 8th and his Tiny BASIC. ELF2K and other video-based COSMACS, run at 1.8Mhz.

From Lee Hart posts: I supply a 1.8 MHz resonator with the rev. F and rev G kits, to match the frequency normally used in ELFs with the 1861 video chip. But you can replace it with a faster [and more common] one, [such as] 2 MHz. These resonators are available from Mouser, Digikey, etc. The Membership Card stock clock circuit part is a 4093 schmitt-trigger 2-input NAND gate, with about a 300 nsec propagation delay. However, the 4093 oscillator just barely works at 2 MHz at 4v. You'll need a 5v supply for reliable operation at 2 MHz. - Lee Hart

The 1802 is spec'd at 2.5 MHz at 5v, though many run faster. Also: the CMOS 1802 can run faster at higher DC voltage but the Membership Card is not designed to support that. Read the COSMAC 1802 data sheets for details. This note only addresses 5V operation. Finally: a faster NAND gate would work better above 2Mhz, but the trick is to find one pin-compatible with the CD4093. Lee suggested looking for a Toshiba brand TC74HC4093; if you try a 74HC132, note some of its gates are on the "wrong" pins.

The Rev F and later Membership Cards has both an RC oscillator [and trimpot to adjust] *and* a 1.8 MHz ceramic resonator. The earlier ones had only the RC oscillator. A ceramic resonator can be added to older revision cards, see this Tech Note.

Lee Hart added: The supported baud rate is strongly affected by the 1802 clock frequency. Just like baud rate generator ICs, certain clock frequencies are good, others are bad. [In a software UART routine,] you have to be able to "hit" the baud rate within 1-2% with one of the coarse choices of clock divider integers. The baud rate divisor in the RCA and IDIOT monitors was pretty coarse (they expected teletypes and other slow mechanical consoles). - Lee Hart

What to run as a serial monitor?

In Oct 2015, Jonathan Mordosky introduced in the Yahoo (later groups.ip) cosmacelf mail list, a simple serial binary loader, that can be toggled into RAM at 0000H. Here's the Web page with that serial binary loader. Lee Hart offers his comments and a varient of the code.

This Web site offers the "IDIOT" monitor program, adapted by Lee Hart from the early RCA "UT4" monitor program. It avoids "long jumps" so it can run from any "page" in memory; it finds RAM or runs without RAM. You may need to change how Q is set/reset or EF3 is read, depending on the serial interface you choose; the code provides such options. A serial interface kit and instructions for use with IDIOT is on this Web page.

Other ROM monitors: Many ELF-like computer owners, use the "ELF2K" ROM from Spare Time Gizmos. Check their Web site, or sites which discuss ELFs, for details. Also, many members of the groups.io cosmacelf discussion group, have written or archived there, various 1802 monitor programs. Again: the serial interface is necessary for operation of monitor programs. - Herb Johnson


Contact information for Herb Johnson:
Herb Johnson
New Jersey, USA
To email @ me, see
see my home Web page.

This page and edited content is copyright Herb Johnson (c) 2020. Contact Herb at www.retrotechnology.com, an email address is available on that page..