cancel
Showing results for 
Search instead for 
Did you mean: 

DAC Sine Wave & Vertical Shift

Theorem25
Associate

Hi,

I've successfully generated a sine wave using stm32 DAC. The current generated sine wave has the following properties; where min amplitude is 0 to max amplitude 4096 and the zero crossing is at 2048. I'd like to shift the output sine wave amplitude to where min amplitude -2048 to max amplitude 2048 and zero crossing is at 0. Are there any registers or methods i can use to achieve this task? 

 

Best Regards,

Vu

1 REPLY 1
Peter BENSCH
ST Employee

There are ways to get a zero-balanced output voltage - but not with an MCU that only has a positive supply voltage.

Let's think about this: your DAC output ranges from 0...4095 (not 4096, because zero also is one step), which corresponds to a full voltage swing, e.g. 0...3.3V. In order to shift the range by 2048 in the negative direction, you would have to be able to output a negative voltage - but where would this come from?

For this reason, there are electronic circuits such as a level shifter with an opamp that can achieve your goal using a simple differential amplifier, which can be found, for example, in the Wikipedia article on the topic opamp applications.

Hope that helps?

Regards
/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.