Mr RB
Well-Known Member
Hi, I'm thinking of making a piece of test equipment with a PIC microcontroller.
The test equipment needs to generate accurate frequency sinewaves of a (reasonably) fixed amplitude under PIC control for sweep and band testing purposes.
I know how to make accurate frequency sinewaves at lowish frequencies using the PIC timer and PWM module and feeding the PWM module from a sine table after each exact period. However with my PIC 18F running at 10 MIPs this system is only good for about 8kHz sine generated, once it gets much higher than that the system must severely sacrifice the quality of the sinewave so it won't reach the 20kHz required.
Another option is to generate the sine wiht an external IC like an XR2206 controlled from the PIC but this reuires a lot of extra complexity and even with closed loop frequency control (PIC measuring frequency) there is still a big chance of freq error or freq instability.
It would be much preferred to generate the frequency directly using the PIC xtal locked timer, and also be good to avoid the use of too much external hardware.
Can anyone suggest a clever solution? Going to a faster PIC 24F etc is not possible, but I am open to the option of PIC generating an accurate squarewave and using some small amount of external hardware to shape that into a sine.
Maybe there is a way to generate 2 lower frequency sines on the PIC and use the higher beat frequency?
Even though I am limited to PIC 18F I have quite a few digital output pins available so maybe there is an option using an external R2R DAC or something?
The test equipment needs to generate accurate frequency sinewaves of a (reasonably) fixed amplitude under PIC control for sweep and band testing purposes.
I know how to make accurate frequency sinewaves at lowish frequencies using the PIC timer and PWM module and feeding the PWM module from a sine table after each exact period. However with my PIC 18F running at 10 MIPs this system is only good for about 8kHz sine generated, once it gets much higher than that the system must severely sacrifice the quality of the sinewave so it won't reach the 20kHz required.
Another option is to generate the sine wiht an external IC like an XR2206 controlled from the PIC but this reuires a lot of extra complexity and even with closed loop frequency control (PIC measuring frequency) there is still a big chance of freq error or freq instability.
It would be much preferred to generate the frequency directly using the PIC xtal locked timer, and also be good to avoid the use of too much external hardware.
Can anyone suggest a clever solution? Going to a faster PIC 24F etc is not possible, but I am open to the option of PIC generating an accurate squarewave and using some small amount of external hardware to shape that into a sine.
Maybe there is a way to generate 2 lower frequency sines on the PIC and use the higher beat frequency?
Even though I am limited to PIC 18F I have quite a few digital output pins available so maybe there is an option using an external R2R DAC or something?