Question:

Can someone guide me to generate a triangular wave using a pic microcontroller...?

by  |  earlier

0 LIKES UnLike

Can someone guide me to generate a triangular wave using a pic microcontroller...?

 Tags:

   Report

1 ANSWERS


  1. You can use just about any uC to do this and there are several ways to generate the output voltage.

    1.)The output signal can be generated by using a PWM output passed through a Low Freq RC filter to convert it to an analog DC voltage level.

    2.)The uC can control a DAC (digital to analog converter) via I2C or SPI communication.

    3.) If you have enough output pins and you can handle an 8bit or so resolution you can make your own DAC using a R2R resistor network.

    PWM is easy to do using  one harware Counter/Timer that can toggle an output pin for PWM generation.

    A second Counter is used as an Up/Down counter counting from zero to a max value then reversing direction and counting from max to zero.    The prescale value for this counter is set several orders higher than the PWM counter so that the PWM counter has time to generate several cycles of PWM output at teh designated duty cycle.

    Periodially the value of the Up/Down counter is passed to the PWM counters Compare Match register which will change the output duty cycle.

    If you only have One harware counter available then use it for the PWM generation.   Then using DDS (direct digital sysnthesis) techniques you can use the value of a single totalizing register incremented periodically as an address to a lookup table. The lookup table holds the values of the wave form amplitude at different ponts in the cycle. It is the lookup values that are then passed to the PWM counter

    I

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.