> I've got a variable frequency signal (200hz to 4khz) whose frequency I want > to increase by 30% (5v signal). IE if the input frequency is 1000hz, I > want to output 1300hz. Is there an easy method of doing this? I've heard > of PLL, but don't have a clue how to build them, so if there's an easier > option that would be great. > > Gary It depends on what you need to do with the signal. If the resulting output signal can have significant jitter, and unequal size cycles then this job can easily be done with a single component: an 8-pin PIC. If you need to keep a 'square wave' output then it gets a little trickier, but can still be done in a small PIC. Just to give you an idea of how you could do it if jitter and output cycle size don't matter: ; ===================== ; The main loop. Each iteration of this loop processes ten ; cycles of the input signal (in the copypulse routine). Three of ; those cycles are doubled by calling the outpulse routine ; to send an extra pulse in the low portion of the input ; pulse. mainloop: call copypulse call copypulse call copypulse call outpulse call copypulse call copypulse call copypulse call outpulse call copypulse call copypulse call copypulse call outpulse call copypulse goto mainloop ; ===== copy an input pulse to the output pin ====== copypulse: ; look for the rising edge waithi: btfss INPUT goto waithi btfss INPUT goto waithi ; we just saw a rising edge, copy it to the output bsf OUTPUT ; wait for the input to go low again waitlo: btfsc INPUT ; wait for input to be low goto waitlo btfsc INPUT ; check twice to protect against glitches goto waitlo ; we just saw a falling edge, copy it to the output bcf OUTPUT retlw 0 ; ===== output an extra pulse ===== ; ; At 4Hz (the maximum input frequency) the low level during ; which we have to output our extra pulse lasts for 1/8000 ; of a second. We have to fit a low-high-low into that time ; to fit our pulse in. To allow for input jitter and modest ; overfrequency we'll set the time for the first low and high ; to about 1/32000 of a second outpulse: ; output low for 1/32000 of a second call delay ; delay 1/32000 ; output high for the next 1/32000 bsf OUTPUT call delay ; output low until the next pulse bcf OUTPUT retlw 0 Bob Ammerman RAm Systems -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics