Hi, > Hi everyone, > I'm trying to find some code for a frequency genetator using a PIC. > 0Hz to 10khz 0.5Hz or 1Hz increments. > I have been experiementing with PIC16C84, dividing a known frequency > from the TRM0 Interupt, but dividing freqencies will not give me the > freqency increments I need. > eg 1MHz/100 = 10kHz > 1MHz/101 = 9900.9Hz > > 1MHz/1,000,000 = 1Hz > 1MHz/1,000,001 =0.9999999 > > Any help will be greatly appretiated > I designed a 1-10KHz frequency generator with a 1Hz resolution about a year ago. I used a numerically controlled oscillator (NCO) IC from Harris (HSP45102) with a PIC. You simply download the divisor to the IC via its SPI interface. It actually outputs a 12 bit sine wave but I only used the most significant bit to get a square wave. I don't think that a PIC alone would be sufficient. You could also use a PLL frequency synthesizer. The problem is that 1Hz-10KHz spans 4 decades which would make the oscillator design tricky. Niki