Stm32 DAC configuration Process

Source: Internet
Author: User

The channel of the DAC module outputs an analog voltage with the following detailed setup steps:

1) Turn on the PA port clock and set the PA4 as analog input.

Stm32f103zet6 DAC Channel 1 is connected to the PA4, so we first want to enable the Porta clock, and then set the PA4 as the analog input (although the input, but the STM32 inside will be connected to the DAC analog output).

2) Enable DAC1 clock.

As with other peripherals, you must first turn on the appropriate clock to use it. The STM32 DAC module clock is provided by APB1, so we first set the clock enable of the DAC module in the APB1ENR register.

3) Set the operating mode of the DAC.

This partial setting is all implemented through the DAC_CR setup, including: DAC Channel 1 Enable, DAC Channel 1 output cache off, no trigger, no waveform generator, and so on.

4) Set the output value of the DAC.

With the setup of the previous 3 steps, the DAC can start working, we use the 12-bit right-aligned data format, so we can get a different voltage value at the DAC output pin (PA4) by setting the DHR12R1.

Stm32 DAC configuration Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.