RC lowpass filter expands microcomputer's output port

Rex Niven

EDN

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.

RC lowpass filter expands microcomputer's output port
Figure 1. This single-pin “bus” can provide an unlimited number of
parallel outputs with simple additional hardware.

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).

RC lowpass filter expands microcomputer's output port
Figure 2. The clock and data signals combine into one signal.

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.

Listing 1. Whip-routine output function for PIC microcontroller

Whip                              
      MOVWF   My_Data               ; the data to transmit is in W {регистр W}
      MOVLW   8                   
      MOVWF   Bit_Counter           ; set up for eight bits
      BSF     My_Port, My_Bit       ; ensure output is initially high
Bl:
      RLF     My_Data, F            ; data to send is in CC
      BTFSS   STATUS, CC          
      BCF     My_Port, My_Bit       ; zero, so falling edge is early
      CALL    Delay_10us            ; if a one, pin stays high for l0Ous
      BCF     My_Port, My_Bit       ; if a one, edge falls here
      NOP                           ; ensures output pin is low for 0.2us min
      BSF     My_Port, My_Bit       ; rising edge here clocks data into HC164
      DECFSZ  Bit_Counter         
      GOTO    Bl                  

      RETURN

RC lowpass filter expands microcomputer's output port
Figure 3. This circuit uses another serial-in/parallel-out register, the MC14094,
which has a strobe input to allow simultaneous updates of all outputs
without temporary levels.

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.

Materials on the topic

EDN

EMS supplier