12.07.2015 Views

Digital to Analog Converter - AN0022 - Application ... - Energy Micro

Digital to Analog Converter - AN0022 - Application ... - Energy Micro

Digital to Analog Converter - AN0022 - Application ... - Energy Micro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3 Advanced Features...the world's most energy friendly microcontrollers3.1 Sine Genera<strong>to</strong>r ModeThe DAC contains an au<strong>to</strong>matic sine genera<strong>to</strong>r mode, which is enabled by setting the SINEMODE bitin the DACn_CTRL register. In this mode, the DAC data registers are overridden with conversion datataken from a hardware sine lookup table. The lookup table consist of 16 samples. When the OUTENPRSbit in DACn_CTRL is cleared, the sine genera<strong>to</strong>r will output the next sine-sample when a PRS conversiontrigger pulse is received. This is illustrated in Figure 3.1 (p. 6) .Figure 3.1. Sine Genera<strong>to</strong>r Mode with PRS-triggered SamplesOne PRS HFCLK PulsePRS pulse period changedCH0 PRSDACn_OUT0Sine Sam plesBy having a timer supply the PRS pulses on compare or overflow the frequency of the sine wave canbe accurately controlled.If the OUTENPRS bit is set, the PRS channels selected by PRSSEL in DACn_CH0CTRL andDACn_CH1CTRL switches on and off the sine wave (CH0 PRSSEL) and output driver (CH1 PRSSEL).The sine genera<strong>to</strong>r will now trigger new conversions by itself. If the channel 0 PRS line is low, a voltageof Vref/2 will be produced. When the line is high, the sine wave will be produced. The PRS line selectedfor channel 1 controls the output-driver which is tristated when the PRS line is low. This is illustratedin Figure 3.2 (p. 7) .The frequency when the OUTENPRS bit is set is given by Equation 3.1 (p. 6) :Sine Generation with OUTENPRS bit setf sine = f HFPERCLK / 32 x (PRESC + 1) (3.1)The sine wave will be output on channel 0. If the DIFF bit is set in DACn_CTRL, the sine wave will beoutput on both channels (if enabled), but inverted on the second channel (see Figure 3.2 (p. 7) ).Note that when OUTENPRS in DACn_CTRL is set, the sine output will be reset <strong>to</strong> 0 degrees when thePRS line selected by CH0PRSSEL is low.2013-05-08 - an0022_Rev1.09 6 www.energymicro.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!