| Electronic Components Datasheet Search |
|
AN4104 Datasheet(PDF) 10 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN4104 Datasheet(HTML) 10 Page - STMicroelectronics |
|
10 / 13 page ![]() DMA programming examples AN4104 10/13 Doc ID 023131 Rev 1 3 DMA programming examples The DMA firmware driver is provided with a set of examples, so you can quickly become familiar with the DMA peripheral. It demonstrates how to use the DMA in different modes. Both the package and the application note are available for download from the STMicroelectronics website: http://www.st.com. 3.1 ADC DMA transfer to TIM example This example provides a description of how to use a DMA channel to transfer continuously a data from a peripheral (ADC) to another peripheral (TIM) supporting DMA transfer. The ADC is configured to operate in Continuous Conversion mode. TIM is configured to generate a PWM signal on its output. The dedicated DMA channel is configured to transfer in circular mode the last ADC channel converted value to the TIMER Capture/Compare register. The DMA channel request is driven by the TIM update event. The duty cycle of TIMER channel output signal is then changed each time the input voltage value on ADC channel pin is modified. The duty cycle variation can be visualized on oscilloscope while changing the analog input on ADC channel using the potentiometer. 3.2 DMA Flash to RAM example This example illustrates how to use the DMA to transfer data between two memory locations. It provides a description of how to transfer a word data buffer located in Flash memory to embedded SRAM memory using DMA channel. DMA Channel is configured to transfer the contents of a 32-word data buffer stored in Flash memory to the reception buffer declared in RAM. The start of transfer is triggered by software. DMA Channel memory-to-memory transfer is enabled. Source and destination addresses incrementing is also enabled. The transfer is started by setting the Channel enable bit for DMA Channel. At the end of the transfer, a Transfer Complete interrupt is generated since it is enabled. Once interrupt is generated, the remaining data to be transferred is read which must be equal to 0 (DMA Counter reaches 0 if all Data are transferred). The Transfer Complete Interrupt pending bit is then cleared. A comparison between the source and destination buffers is done to check that all data have been correctly transferred. 3.3 DMA RAM to DAC example This example provides a description of how to use a DMA channel to transfer data buffer from memory (RAM memory) to the peripheral DAC. The DMA channel is configured to transfer continuously, word by word, a Half-word buffer from the RAM memory to the DAC register DAC_DHR12R. The DAC channel conversion is |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |