Introduction - If you have any usage issues, please Google them yourself
By changing the DA output voltage of the microcontroller, we can get all kinds of voltage waveform output. The following describes how to generate the sinusoidal waveform and how to calculate the data needed to send DA.
First, since it is a sine wave, so it is necessary to determine a cycle of sine wave output from point sampling points, how many points form a cycle of a sine wave, but also know the output of DA singlechip digital value number is maxnum, for example
8 bit DA, maxnum=256. 10 bit DA, maxnum=1024.
Sin_tab= (maxnum/2) *sin (x) + (maxnum/2); / / I x on behalf of a point for a corresponding angle radian angle radian = * (n /180); / / DA (maxnum/2) at the