A "Poor Man's Logic Analyzer" With TTL Threshold Detection
Posted: Fri Apr 03, 2020 8:12 am
In the Weird data bus write problem thread there was some discussion of why a Ben Eater-type "poor man's logic analyzer" made by planting an Arduino on a 6502 address and data bus was detecting a write as a $00 rather than the value the code was writing; this turned out to be because an accidentally-enabled EPROM (and perhaps other things) were also driving the data bus. I started discussing ways of detecting "bad" bus signals that were being pulled away from the proper 0 and 1 voltage levels by posting about my "Octal TTL Logic Probe."
Since that seems to be turning into a bit of a discussion, and I'd like to avoid too far derailing speculartrix's thread, I'm reposting my first post about that here as the start of a new thread. You may also wish to read the two replies there from GARTHWILSON and Chromatix after reading this first post but before continuing on with the remainder of this thread.
___________________________________________________________
Regarding using a logic analyzer on circuits, I had some strong worries about this when I was having difficulties with the output of my 6821 PIA. The outputs on that are very weak compared to modern chips, and I wasn't sure if something I hadn't noticed was driving the line even a little. I wanted to look at all eight outputs at once (too many for my 'scope), but a regular old logic analyzer wasn't going to tell me if I had firm or dodgy voltages.
To solve this, I was inspired by an idea I saw in the second of Garth's schematics in the Interfacing to SPI and Microwire section of his circuit potpourri page. There he uses op-amps rigged as comparators against a 2.5 V reference to light LEDs when the input voltage is above that level. I realized that if sent this input to a pair of op-amps and LED, one rigged to light when input is between 0 and 0.5 V and the other rigged to light when the input is between 2.7 V and 5.0 V (all the figures assume that Vcc is 5.0 V and scale with Vcc), you'd have a logic probe, and you'd know if the "low" or "high" light was on that it was truly a low or high signal. If neither light is on, you're somewhere in between and in trouble. Plus, since you're using op-amps as the front end, with very high-impedence inputs, you know that they'll be having a minimal effect on the circuit under test.
So I consed up a little design with four quad LM324 op-amps (chosen specifically because they were the only op-amps I had in my parts bin :-P), sixteen LEDs, and some resistors and trimmer pots to let me set and trim the reference voltages. It's described it in more detail in my Octal TTL Logic Probe notes, and I've attached pictures below.
(The blue trim pots are on the lower side of the voltage dividers producing the reference voltage, allowing me to tweak it a bit. Below that are the high-side resistors and a socket for custom resistors; each resistor can be switched in and out using the switches below them, the left four for the low reference and the right four for the high reference. The permanently mounted resistors give me a choice of 0.5 V or 0.8 V (TTL max out and max in for "0") as a low reference, and 2.7 or 2.0 V (TTL min out and min in for "1") as a high reference. I stuck in the socket so I could do CMOS levels or whatever as well, should I ever have the need.)
This board would be fine for examining the situation in a single-stepped system, and might even be adequate for examining the OP's situation, where he was running the system at 1 Hz, but of course you won't be able to keep up with it at faster speeds. But if you swapped out the LEDs for a couple of parallel-input shift registers read by an Arduino, you've turned your "poor man's logic analyzer" into a multi-input logic probe that will much more reliably tell you if your voltages are solid or if you have rubbish on your bus.
And, oh yeah, if you're going to build one of these, consider using a bigger board than I used. This one is really tight and was a nightmare for me to solder. :-)
Since that seems to be turning into a bit of a discussion, and I'd like to avoid too far derailing speculartrix's thread, I'm reposting my first post about that here as the start of a new thread. You may also wish to read the two replies there from GARTHWILSON and Chromatix after reading this first post but before continuing on with the remainder of this thread.
___________________________________________________________
Regarding using a logic analyzer on circuits, I had some strong worries about this when I was having difficulties with the output of my 6821 PIA. The outputs on that are very weak compared to modern chips, and I wasn't sure if something I hadn't noticed was driving the line even a little. I wanted to look at all eight outputs at once (too many for my 'scope), but a regular old logic analyzer wasn't going to tell me if I had firm or dodgy voltages.
To solve this, I was inspired by an idea I saw in the second of Garth's schematics in the Interfacing to SPI and Microwire section of his circuit potpourri page. There he uses op-amps rigged as comparators against a 2.5 V reference to light LEDs when the input voltage is above that level. I realized that if sent this input to a pair of op-amps and LED, one rigged to light when input is between 0 and 0.5 V and the other rigged to light when the input is between 2.7 V and 5.0 V (all the figures assume that Vcc is 5.0 V and scale with Vcc), you'd have a logic probe, and you'd know if the "low" or "high" light was on that it was truly a low or high signal. If neither light is on, you're somewhere in between and in trouble. Plus, since you're using op-amps as the front end, with very high-impedence inputs, you know that they'll be having a minimal effect on the circuit under test.
So I consed up a little design with four quad LM324 op-amps (chosen specifically because they were the only op-amps I had in my parts bin :-P), sixteen LEDs, and some resistors and trimmer pots to let me set and trim the reference voltages. It's described it in more detail in my Octal TTL Logic Probe notes, and I've attached pictures below.
(The blue trim pots are on the lower side of the voltage dividers producing the reference voltage, allowing me to tweak it a bit. Below that are the high-side resistors and a socket for custom resistors; each resistor can be switched in and out using the switches below them, the left four for the low reference and the right four for the high reference. The permanently mounted resistors give me a choice of 0.5 V or 0.8 V (TTL max out and max in for "0") as a low reference, and 2.7 or 2.0 V (TTL min out and min in for "1") as a high reference. I stuck in the socket so I could do CMOS levels or whatever as well, should I ever have the need.)
This board would be fine for examining the situation in a single-stepped system, and might even be adequate for examining the OP's situation, where he was running the system at 1 Hz, but of course you won't be able to keep up with it at faster speeds. But if you swapped out the LEDs for a couple of parallel-input shift registers read by an Arduino, you've turned your "poor man's logic analyzer" into a multi-input logic probe that will much more reliably tell you if your voltages are solid or if you have rubbish on your bus.
And, oh yeah, if you're going to build one of these, consider using a bigger board than I used. This one is really tight and was a nightmare for me to solder. :-)