At 09:37 AM 10/28/97 -0800, you wrote: >Hello, > >I ran into a strange problem last night. I am using a 3-to-8 decoder >(74HC138) and alternately selecting Y1 and Y6 outputs. I am somehow >getting spikes on the Y0 output. The Y0 output should be high when >not selected but the negative spikes go low enough to register as a low >on other HC devices. Decoupling the Y0 output to ground via a 1nF cap >seems to get rid of the spikes. > >Has anyone ever run into some similar problem?? this is a common problem in digital design. you are seeing something called a "hazard", or transition state. here's the problem: when the PIC transitions its outputs from 1 to 6, it pulls some pins hig h, some low. it can't possibly do this instantaneously, and some pins take a few nanoseconds longer than others to change. so the decoder sees this: write a 1 : output is 001 write a 6 : output is 001 (takes a few ns to change) output is 001 output is 000 (decodes a 0) output is 100 (decodes a 4) output is 110 (decodes a 6) there are several ways around this. first off, in general it is very bad design practice to use a decoder output as a clock unless you are gating the part with another signal. (the 138 has 3 gating signals.) by gating the part you can turn it off during input transitions that may cause glitches. secondly, you can design using minimized logic and count only in gray code. gray code is a method of counting that ensures only one transition per count. a typical gray code 0 to 7 count might look like: 000 001 011 010 110 111 101 100 however, this method does not allow you to select decoder outputs in an arbitrary fashion, like you were doing. finally, you can try to filter out the pulses, but this can get messy in practice. an RC filter followed by a schmitt trigger can work well. -bill von novak