3101 views|8 replies

85

Posts

0

Resources
The OP
 

[Atria AT32A403A automotive MCU development board] + adjustable sine wave output with DAC [Copy link]

Chapter 8: Using DAC to output adjustable sine wave

This article will evaluate the DAC output sine wave of AT32A403A.

The AT32A403A is equipped with a 12-bit DAC with a maximum update rate of 1MSPS and two channels. At the same time, the built-in output gain can be used to reduce the output impedance and directly drive the load without an external op amp.

When the output gain is not enabled, the output voltage range is larger, and the output is basically rail-to-rail. After enabling, the output is not rail-to-rail, and there is a rise of about 200mV.

-----------------------Start transplanting------------------------

The resources needed here include DAC.

First, create C files such as DAC.c and their corresponding h header files in the Hardware folder.

Select the PA4 output corresponding to DAC1, use software triggering, and do not enable cache. Do not use the DMA in the example, and the initialization is relatively simple.

Because we want to generate a sine wave here, we need to calculate the digital quantity required to output the sine wave. Here we use the sin() function directly to calculate. We need to add the <math.h> header file. The specific calculation formula is:

Where Sine_Dot_Num is the number of points contained in a waveform. The more points there are, the finer the waveform is, but the generated waveform frequency is lower because the update rate of the DAC is fixed.

It should be noted here that the DAC's sine wave data table must be generated first and then written to the output, because calculating and outputting at the same time may affect the update rate of each point of the DAC.

Finally, the analog value is output through the dac_1_data_set function

.

-----------------------practical testing------------------------

Try different output points: 50, 100, 200. After actual testing, 100 points basically works. Because the oscilloscope was suddenly damaged and could not be repaired during the Chinese New Year, I cannot take screenshots. I will take screenshots when I have the chance. (It has been broken twice, which is very uncomfortable)

The conclusion is that if this DAC is used to output a sine wave, the frequency should be limited to below 10KHz, otherwise it is basically unusable. Of course, the DAC built into the MCU is generally not used to generate medium and high frequency arbitrary waves. After all, it is not a high-speed DAC, but is used to generate static voltage.

At this point, the DAC output sine wave has been tested and is in a usable state.

This post is from Automotive Electronics

Latest reply

But it has advantages in size and convenience.     Details Published on 2024-2-14 23:26

9720

Posts

24

Resources
2
 

What kind of oscilloscope is so prone to breaking?


This post is from Automotive Electronics

Comments

Virtual Oscilloscope Dream Source  Details Published on 2024-2-14 23:26
Virtual Oscilloscope Dream Source  Details Published on 2024-2-13 15:08
 
 

2w

Posts

341

Resources
3
 

Is the oscilloscope's key settings messed up? Try the reset button to do an automatic test. It's usually not easy to break.

This post is from Automotive Electronics

Comments

Virtual oscilloscopes are still not as reliable as desktop ones.  Details Published on 2024-2-13 15:09
 
 
 

85

Posts

0

Resources
4
 
littleshrimp posted on 2024-2-13 09:02 What kind of oscilloscope is so prone to breaking?

Virtual Oscilloscope Dream Source

This post is from Automotive Electronics
 
 
 

85

Posts

0

Resources
5
 
qwqwqw2088 posted on 2024-2-13 09:56 Is the oscilloscope's button settings messed up? Try the reset button to automatically test it. It's usually not easy to break.

Virtual oscilloscopes are still not as reliable as desktop ones.

This post is from Automotive Electronics

Comments

But it has advantages in size and convenience.    Details Published on 2024-2-14 23:26
 
 
 

6075

Posts

6

Resources
6
 
littleshrimp posted on 2024-2-13 09:02 What kind of oscilloscope is so prone to breaking?

Be prepared to avoid pitfalls    

This post is from Automotive Electronics

Comments

The main thing is that I tested it here before and it was broken. The manufacturer said it was not broken. I sent it back and then it broke again.  Details Published on 2024-2-17 13:41
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

6075

Posts

6

Resources
7
 
dmzdmz666666 posted on 2024-2-13 15:09 Virtual oscilloscopes are still not as reliable as desktop ones

But it has advantages in size and convenience.  

This post is from Automotive Electronics

Comments

If this is a general test requirement, a portable oscilloscope can do the job.   Details Published on 2024-2-17 13:40
Personal signature

在爱好的道路上不断前进,在生活的迷雾中播撒光引

 
 
 

85

Posts

0

Resources
8
 
Qintianqintian0303 posted on 2024-2-14 23:26 However, it has advantages in size and convenience

If this is a general test requirement, a portable oscilloscope can do the job.

This post is from Automotive Electronics
 
 
 

85

Posts

0

Resources
9
 

The main thing is that I tested it here before and it was broken. The manufacturer said it was not broken. I sent it back and then it broke again.

This post is from Automotive Electronics
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list