I'm designing a phonic wheel emulator. I have a PIC18F4550 and the following power supplies: +5V, -5V, 12V. I need to geneate a sine waves from frequencies near 500Hz up to approximately 8kHz. The shape does not need to be a perfect sine, but the amplitude needs to be at least 10V or higher for all frequencies.

The controlling of the frequencies can be made manually or digittaly (it means the person can vary the frequency using a potentiometer or typing the frequency on the device)

I thought to generate a square wave by the microcontroller and use a active filter to filter the high order harmonics, but I think this is not a good approach because the frequency band is relativelly wide. I heard about sine lookup table and DAC, but PIC18F does not have DAC module.

I read about LTC1066-1 at the best answer chosen to this question. But I didn't understand very well, it seems to use a PLL and a LTC1066, it seemed a bit expensive and complex to me.

Another approach is one that I found here. But it sems to be even worse because it does not have a explanation of the signals required only a electrical scheme with some signal inputs that I don't know from where it come from.

Is there a simpler and non expensive way of reach this purpose ? Does someone have any suggestion ?

  • 3
    \$\begingroup\$ I recommend you take a look at some old Microchip app-notes for generating DTMF tones using a little old 8-bit PIC (as far as I remember even older & slower than the 18F4550 you're using). In the past I've use code from there to quite successfully produce sine-ish signals through a filtered PWM over a reasonable range of frequency adjustment. \$\endgroup\$
    – brhans
    Jun 25, 2019 at 16:58
  • 2
    \$\begingroup\$ AN543 was the one I based most of my work on, and I've implemented it on about 10 different PICs, including the 18F4550 you're using. \$\endgroup\$
    – brhans
    Jun 25, 2019 at 17:01
  • 1
    \$\begingroup\$ If you want to go the DDS route you can build an R2R DAC off a few of the GPIO pins \$\endgroup\$
    – sstobbe
    Jun 25, 2019 at 17:13

1 Answer 1


You can use an external DAC IC and have the PIC talk to it using SPI, I2C, or some other interface. As you mentioned, you would use a lookup table in the firmware. To change the frequency, just change the rate at which you update the DAC with a new sample from the lookup table. Alternatively, you could keep the update rate the same, but skip entries in the lookup table to change the frequency.

If you need > 10V pkpk amplitude, tied the DAC reference to +12V if you are using a unipolar DAC. Or you can use a bipolar DAC and tie Vref+ to +5V and tie Vref- to -5V, which should give you close to 10V pkpk.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.