用的matlab生成的数据,目前还没有采用定时器与DMA 后期会考虑,现在的问题是为什么呢?恳请大佬赐教
下面是主函数
- #include "sys.h"
- #include "delay.h"
- #include "usart.h"
- #include "led.h"
- #include "dac.h"
- #define SAMPLE_POINTS 100
- #define DELAY_TIME_MS 1
- // ²¨ÐÎÊý¾Ý
- const uint16_t sine_wave_values[SAMPLE_POINTS] =
- {
- 1650, 1754, 1857, 1959, 2060, 2160, 2257, 2353, 2445, 2534,
- 2620, 2702, 2780, 2853, 2921, 2985, 3043, 3096, 3143, 3184,
- 3219, 3248, 3271, 3287, 3297, 3300, 3297, 3287, 3271, 3248,
- 3219, 3184, 3143, 3096, 3043, 2985, 2921, 2853, 2780, 2702,
- 2620, 2534, 2445, 2353, 2257, 2160, 2060, 1959, 1857, 1754,
- 1650, 1546, 1443, 1341, 1240, 1140, 1043, 947, 855, 766, 680,
- 598, 520, 447, 379, 315, 257, 204, 157, 116, 81, 52, 29, 13, 3,
- 0, 3, 13, 29, 52, 81, 116, 157, 204, 257, 315, 379, 447, 520, 598,
- 680, 766, 855, 947, 1043, 1140, 1240, 1341, 1443, 1546
- };
- int main(void)
- {
- delay_init(168);
- LED_Init();
- Dac1_Init();
- while(1)
- {
- for (int i = 0; i < SAMPLE_POINTS; i++)
- {
- Dac1_Set_Vol(sine_wave_values[i]);
- delay_ms(DELAY_TIME_MS);
- }
- }
- }
复制代码
|