Saturday, September 18, 2010

8085 Disaster! (well, a minor setback, but I'm not happy about it.)

I'm in the final stages of assembling the permanent hand-wired version of my 8085 project, and I've run into a problem.

3 Switches Become 1 Big Problem

There are three critical switch inputs to the 8085 on the front panel. They are the TRAP, RST5.5 and RST7.5 signals to the 8085. Essentially, each tells the 8085, "Stop what you're doing and do this instead."

It Worked Fine on the Test Bench!

When I built this project on solderless breadboard I didn't have any serious space limitations, so I did full "debouncing" on each switch, to prevent electrical noise caused by the switch from sending a whole bunch of "stop what you're doing!" messages all in a row when the user just presses the switch once.

On the soldered-up permanent version, I decided to save a little bit of space on the circuit board by trying to debounce on the cheap. A normal debounce circuit uses two inverters to clean up the electrical noise. I had a chip on the board that had six inverters in it, two of which were in use. That left me four inverters, for three signals. I needed six to do the job right.

Too Clever by Half

But, I had a "clever" idea. I thought I'd see if I could get by with a circuit that only uses one gate per signal. Not a full debounce, but a circuit called a "Schmitt Trigger." I built it up and tested it on the solderless breadboard.

It worked just great!

Then I built it up on the soldered board. It worked great there, too.

Then I went and bought some prettier switches to use on my new system's box. It worked pretty well. It seemed OK...

Then I did a test fit on the box with all the parts. I pressed my pretty new switches.


When I was pressing the new switches on a handheld box, rather than against a tabletop, I got a whole bunch of signals sent to the 8085 for each time I pressed the switch. The results were pretty ugly.

A Quick Fix is No Fix

I tried out some quick-fixes, as well as making sure all my connections were good. I'd hate to redesign and modify the circuit only to find out the problem was a loose connector all along. The connectors were tight, and the quick fixes helped a bit, but didn't fix the problem. The original (ugly) switches I used worked fine, but I tried a selection of switches in the circuit and most of them had the same problem when hand-held even when they didn't have any problems on the test bench. (I really did test the snot out of this when I first went with the shortcut. But I didn't get all the conditions right for a good enough test. Now I'm paying the price.)

I considered changing out the switches. But this would be a bit of a cop-out. I want to make this something someone else can build and enjoy without having to go through the tweaking and testing and all that I'm doing as I build it. I want others to be able to build it and just have it work, so long as all the bits are in the right places. I can't guarantee that everyone who decides to build it is going to get "clean" switches. So I have to go back and change the design to use real debounce. Then test that, under adverse conditions, like with a rusty knife switch.

One of the quick fixes I tried would probably have been good enough to work under most conditions with a software change that would have delayed any action on the switch input for a fraction of a second. I could have gone with that, and felt sorta pretty good about it. Except that there's a fairly likely condition that that wouldn't cover.

The Deadly Condition

If the user presses the switch, and holds it down for a bit before releasing it, there'll be a second switch event on the release. If someone has a habit of sort of "leaning on" the switches then this will occur to them fairly frequently, and probably ruin their experience using the computer.

I did say these switches are important--in the OS I use them for a warm reset, and vectoring to the user's program. The third one is left for the user in their own programs. But if those functions aren't reliable, it sorta hoses the whole affair. So it's time for me to do the right thing.

Test, Test, Retest, Pray and You Shall Receive

Tomorrow I expect to be protoboarding the correct circuit that I probably should have done in the first place. I'll test it, and if I'm not 100% convinced, I'll use a different sort of circuit, called a "one-shot" or monostable, and make darn well sure with belt and suspenders and a rope tied to a thick tree limb. I may try to avoid adding another IC to the board by using transistors for the last two inverters, or I may try to keep down the varieties of components I use by just dropping in another 4049 in addition to the one there now. On my other part choices I've opted to keep the number of different parts low by reusing the same chips over and over wherever possible.

I'm expecting to put in another 4049, even though it ties up more board space than I like. I might get creative about where I put it, but then again I may not.

Finally, Fitting It In

It's not like I don't have open board space. But I had plans for that space in the future. A memory bank select, another memory IC, and an RS-232 chip. I think the space saved for the RS-232 chip is going to get used. Besides, I may be able to fit in a little Dallas/Maxim chip in one of the odd corners later, or just "float" it on a daughterboard connected to the RS-232 connector.

After all, the core computer has to be working before I start worrying about expansions.

No comments:

Post a Comment