Sawtooth generation internal to the PIC microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by dazed2, Nov 2, 2012.

  1. dazed2

    Thread Starter New Member

    Nov 2, 2012
    I want to generate sawtooth wave of amplitude 0.5v - 3v with frequency of 50khz.

    I am not using DAC , I need to use this as reference signal to compare with the error signal (which is DC voltage , which I will converting in digital using ADC)

    I am using Explorer 16 board with PICFJ128GA010.

    Your help will be appreciated. Thank you.
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Amongst your choices are...

    If the DC error voltage never changes consider making it with some resistors off a fixed voltage to free the D2A.

    A PWM output can make a sawtooth. You may need to follow it by a filter depending on what is consuming the signal.

    You could use a constant current source to charge a cap to make the rising side of the sawtooth, then use a digital pin to short the cap and make the sharp down edge.

    Lots of ways, this barely scratches the surface.
  3. dazed2

    Thread Starter New Member

    Nov 2, 2012
    Thank u very for ur reply

    I should use any hardware, error signal am getting it.
    I need to simulate sawtooth digitally i.e I need to write a program inside PIC
    I have written program to generate sawtooth, but I do not know how to set its amplitude and freq.