Mr. Kok, Sounds like you want six recirculating shift registers that you can pre-load. OK. Imagine a shift register whose last output is fed BACK into the first input via a 1K resistor. Connect a PIC I/O line directly to the shift register's first input. Whenever the PIC I/O line is high, it forces the input high, regardless of the state of the final output. Whenever the PIC I/O line is low, it forces the input low, regardless of the state of the final output. If you re-program the PIC I/O is an INPUT, then the shift register input will be the current state of the shift register's final output (or whichever output is being fed back). For six units, use six individual PIC outputs as shift register data lines. For this application you would want to use a shift register that always presents the internal data on its output lines. If your shift register has LOAD and TRISTATE lines, make both active by hard-wiring to Vss or Vdd as required. As for the Clock line(s), you can use a single I/O pin for all shift registers that will be operating at the same clock speed. Use separate clock lines for any shift registers requiring other clock speeds. Load all six shift registers at a time, and use the clock lines to shift the data in. When it has all been shifted in, switch the PIC data output lines to act as inputs. This will now allow the data to re-circulate via the 1k resistors. The PIC now just has to drive the Clock(s) at the proper speed. The absolute fastest that you can clock direct from the PIC with a 50% duty cycle is based on how long this loop takes: Loop: BSF somereg,somebit NOP NOP BCF somereg,somebit GOTO loop 6 usec using a 4 Mhz PIC. 4 usec without the recommended NOPs, but no longer 50% duty cycle. Still useful. But I recommend at least one NOP between the BSF and BCF instructions. For mixed-clock speeds, consider a longer section between the LOOP label and the GOTO loop instruction. You can use full register writes instead of the BSF/BCF instructions. This allows you to keep multiple clocks all synchronized. Imagine two bits, A and B being loaded as shown for 8 sets of loads: AB 00 01 00 01 10 11 10 11 ----- repeat sequence as often as needed It is clear that B has a frequency that is exactly 4 times that of A. If you need faster clocking speeds, then use an external clock. It can be as fast as the shift registers allow (it is not restricted to the PIC clock speed). Use a PIC I/O pin to control a data multiplexer so that the Clock can come either from the PIC or from the external source. In this case the PIC literally has nothing more to do once it has loaded the shift registers and gated the external clock ON. You can buffer the OSC2/CLKOUT pin and get a 4 Mhz clock almost for free. You can reset via MCLR, of course. If you have any unused PIC I/O lines you can maybe do something else useful with the PIC once it has gated the external clock on. Like blink an LED! *** [OT] *** You can also more easily and cheaply implement this function (minus the blinking LED) with several parallel-load serial-shift shift registers. Hard wire the parallel-load data, or use DIP switches to set the pattern. On power-up, pulse the LOAD line and away you go. Oh yeah, you need a clock source. Fr. Tom McGahee ---------- > From: Mr Kok Lau > To: PICLIST@MITVMA.MIT.EDU > Subject: Shift Registers > Date: Thursday, May 13, 1999 8:59 AM > > Hi, > > I'm building a digital camera, and I need to send some synchronizing > signals to a CCD chip. And on top of that, the ADC that converts the > output signal from the CCD chip has it's own timing diagram as well. I > was thinking of using some form of shift registers which I can program. > Hopefully it'll have 6 output lines, and the chip has it's own > microprocessor. So I can program a sequence in and ask the chip to repeat > that particular sequence for each output line. Does anybody know of a > chip with this kind of capability? > > Or can anybody recomend me some other solution. I'm thinking of using a > PIC, but that would mean I'll have to learn an extra language. And at the > present moment, I'm already tied down trying to learn the programming > language for a digital signal processor which would do some signal > processing of the CCD signals. > > The ultimate aim of the project is to apply kalman filters onto an input > stream of images and track the movement of an object. > > Any help or suggestion would be helpful.