OUT instruction for Membership Card


Last updated July 10 2010. Edited by Herb Johnson, (c) Herb Johnson, except for content written by others. Contact Herb at www.retrotechnology.com, an email address is on that page..

May-June 2010 discussion between P Todd Decker and Lee Hart, on the 1802 OUT instruction and the Membership Card design. See Todd's and Lee's debugging work on this linked Web page. - Herb

P Todd Decker wrote in June 2010:

The membership card seems to work (3 AAs for power). I successfully ran Tom Pittman's memory sequencer program and I was able to execute a two line program to turn on Q. I wasn't able to get Tom's "slow blinker" program to flash Q nor my own that works on the Elf 2000. I will hook the MC up to my scope and check out the clock speed to try and get it set. I ran a small program that SEQ, REQ, BZ $00, and Q stayed lit but dimmer indicating to me that I am able to cycle it. I learned that all the switches need to be off when viewing a program since they are wired to the LEDs.

Does OUT 4 work to display something on the LEDs? I haven't tried that yet...

Lee responds: The Membership decodes OUT5 and OUT7 for the output port; INP5 and INP7 for the input latch. Depending on which Elf you are looking at, these [I/O addresses] can change.

Todd: If I can get down in my lab, I'll make a de-bounced toggle switch and, perhaps, a one-shot then use them to clock the MC at Ray's suggestion to try and see why my MC isn't latching.

I didn't mean to imply that there isn't an output latch; obviously, U7 serves that role. But, it seem to only be acting as a latch when in load mode. When running it, (I'm treading water here) it seems to be reset when the memory read cycle occurs to read the next instruction. Thus, whatever I write to the latch with OUT 5 does not persist when running.

Lee Hart responds: Here's how it's supposed to work during the 1802's the execute cycle of an OUT 5 (or OUT 7) instruction. (View this with a fixed width font like Courier to make the columns line up):

From Lee Hart (corrected 6/17/10):
Here is the timing diagram. Use a fixed width font to view.

  7   0   1   2   3   4   5   6   7   0   __(flip-flop U5a inputs)
 CLK -__--__--__--__--__--__--__--__--__ |
 TPA _____----__________________________ v  TPA latches addr hi byte
 TPB ___________________________----____(CLK)
/MRD -------__________________________--(R) 1802 does a memory read
N0-2 _--------------------------------__    N output (N=5 or N=7)
data -------------------------[ data ]--    data read from memory
/N57 -________________________________--    /N57=0 (U4-3) if N=5 or 7
N+LOAD--------------------------------__(D) N+LOAD inverts /N57 since
                                            /WAIT is high in RUN mode
OUT57___________________________-----___ Q output of flip-flop U5a

U7 outputs      .......old data][new data    U7 loads data on rising edge of
                                        OUT57, and latches it when OUT57
                                        returns low due to /MRD falling 

During the OUT5 or OUT7 instruction's execute cycle, the 1802 reads a byte of memory, and sets the N lines N0-N2 to 5 (101) or 7 (111). This makes the D input of flip-flop U5a high.

On the rising edge of TPB, the flip-flop transfers this high to its Q output. This enables U7 (the output latch) to load the data from memory, so it appears on the LEDs.

The rising edge of /MRD at the end of this cycle resets the flip-flop, so Q goes back low, and U7 now latches the data, so the LEDs continue to display it.

See if you can track through this to find out why yours isn't doing this. - Lee Hart

Herb: Todd did so and found the data would not "latch" at the falling edge of Q. Todd and Lee debugged this as described on this linked Web page. The "fix" was to replace the 74HC373 latch with a 74HC374, to latch the RAM data on the earlier RISING edge of the Q flip-flop (OUT57). This succeeded, but has consequences, as described on the linked Web page. - Herb


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

This page and edited content is copyright Herb Johnson (c) 2010. Contents written by Lee Hart, are copyright Lee Hart (c) 2010. Copyright of other contents beyond brief quotes, is held by those authors. Contact Herb at www.retrotechnology.com, an email address is available on that page..