RC lowpass filter expands microcomputer’s output port
A simple lowpass RC filter allows a single output pin of a microcontroller to expand the number of output bits.
Rex Niven, Forty Trout Electronics, Eltham, Victoria, Australia; Edited by Charles H Small and Fran Granville -- EDN, June 21, 2007
It’s almost a corollary to Moore’s Law: Next year, microcomputers will have more features, and the software team will have bigger ideas. Unfortunately, though, the number of output pins will stay the same. Finding even one spare output for diagnostics, test, or even standard I/O can be a tussle. The single-pin “bus” in Figure 1 can provide an unlimited number of parallel outputs with simple additional hardware. A microcomputer output with an RC lowpass filter controls serial-to-parallel converter HC164. To enter data into the serial-to-parallel converter, each bit consists of a one-to-zero-to-one transition, which alters the length of the low state. If the low state is longer than the lowpass filter’s time constant, a zero shifts into the register. If the low state is short, then a one shifts into the register. The clock and data signals thus combine into one signal. A lowpass filter separates the clock and data signals (Figure 2).
Listing 1, a simple “Whip” routine, performs the output function for eight bits. Assume that the RC time constant is 3 µsec, and the instruction time should be 1 µsec or less at a crystal frequency of 4 MHz or greater. The routine uses bitwise manipulation of output My_Bit of port My_Port.
Although the circuit in Figure 1 can control slow-reacting devices, such as relays or LCDs, using it with LEDs can give an annoying flicker when the HC164 is writing. To address that problem, the circuit in Figure 3 uses another serial-in/parallel-out register, the 4094, which has a strobe input to allow simultaneous updates of all outputs without temporary levels. A twin monostable circuit supplies the data and strobe signals. This circuit should be able to control parallel devices, such as display modules based on HD44780 devices.
-
Would have been nice if you had created the PDF's in a more universal version. I am using Adobe 4.0 and cannot read any of the PDFs. And yes, I have tried upgrading but due to the wonderful nature of Windows, that is currently not possible.
Mark Smith - 2007-7-8 16:23:00 PDT -
I agree, this is a very cute idea, a trick we will probably use as a development-time hack to provide basic diagnostic information from a CPU or MCU with no spare I/O. I will keep it in the back of my mind until the day we need to use it, and then claim that I thought of it myself :-)
Someone should mention that using instruction delays and timing loops to generate short delays requires that interrupts (if used) are locked out around the code that generates the pulse. I'm sure the designer knows this but it isn't spelt out in the text or sample code.
Another thing isn't explained - the 4094-based circuit. As far as I can tell, the bottom monostable generates a 3.3 us active pulse on the data input of the shift register starting from each falling edge of the MCU signal, so if the MCU generates a rising edge immediately after the falling edge, this rising edge will clock a 1 into the shift register, and if the rising edge is later than 3.3 us after the falling edge, it will clock a 0 into the shift register. The top monostable provides a 100 us timeout on the whole operation, so 100 us after the MCU has stopped clocking data into the shift register, the shift register''s STROBE input returns high and that data is transferred to the shift register''s output buffers.
A few other comments. I would drive the shift register slightly differently - data from the input signal, and clock from Q-bar of the bottom monostable, so it would always clock a bit at 3.3 us - I find this easier to understand and explain (and draw a timing diagram for). With the 4538 dual retriggerable monostable, the pulse width is roughly equal to RC (independent of supply voltage). With the two-monostable circuit, interrupts may have to be prevented _between_ bits, as well as within each bit itself, to prevent brief disturbances to the outputs.
Thank you to the author for a nice little idea :-)
Kris Heidenstrom - 2007-24-6 16:45:00 PDT -
This is the most brilliant idea I have seen recently.It is getting rare to see ideas that use less components and a lot of intellectual ingenuity.
I wish to congratulate the writer.
V.Ramprakash - 2007-22-6 00:07:00 PDT


















