Harold Hallikainen wrote: > > Although more complicated on the software side, you COULD > multiplex the LEDs so it would take 7 lines to drive the segments plus > one line to drive each digit (assuming you have high efficiency LEDs so > the PIC can drive seven segments simultaneously, or you'll look at the > thing in the dark). Also, multiplexing can get a bunch of buttons into > the PIC with fewer wires. > If you want to take a hardware approach (recalling that the ideal > design has zero parts), you might look at the CD4511. This is a 7 > segment latch decoder driver. You feed it 4 lines of BCD and strobe a > latch line and it'll hold it. You can then share the 4 bcd lines and > have individual digit strobe lines. Another solution, other than multiplexing is to use shift registers. Having two 74HC164 in series could only use 2 pins. Making the shift fast enough will trick the eye to see the shifting of data. I think it is easier on the software side. Here is the routine to send data serially to 2 74HC164. ;data is in led1 and led2, this routine is untested. datasend: movlw .16 ;16 bits to send movwf count ; loop bcf PORT,CLK_LINE ;clear clock line rlf led1 ;shift data to carry flag rlf led2 ; bcf PORT,DATA_LINE ;assume data is low skpnc ;skip if low bsf PORT,DATA_LINE ; data is high bsf PORT,CLK_LINE ;pulse clock line high, transition occurs here decfsz count ; goto loop ; Regards, Reggie