Board logo

标题: STM32-PIN48脚的STM32F100C8T6B芯片的DA功能 [打印本页]

作者: andylee    时间: 2010-12-4 13:50     标题: STM32-PIN48脚的STM32F100C8T6B芯片的DA功能

STM32-PIN48脚的STM32F100C8T6B芯片的DA功能,已经调试成功。
下面是代码:
RCC_APB1PeriphClockCmd(RCC_APB1Periph_DAC, ENABLE);
   DAC_DeInit();
   
   DAC_Cmd(DAC_Channel_1,ENABLE);
   DAC_Cmd(DAC_Channel_2, ENABLE);
   DAC_InitStructure.DAC_Trigger=DAC_Trigger_Software;//由软件触发
   DAC_InitStructure.DAC_WaveGeneration=DAC_WaveGeneration_None;//关闭波形生成
   DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude=DAC_TriangleAmplitude_4095;
   DAC_InitStructure.DAC_OutputBuffer=DAC_OutputBuffer_Enable;//使能DAC通道缓存  
   /*
   DAC_InitStructure.DAC_Trigger = DAC_Trigger_Software;
   DAC_InitStructure.DAC_WaveGeneration = DAC_WaveGeneration_Noise;
   DAC_InitStructure.DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bits8_0;
   DAC_InitStructure.DAC_OutputBuffer = DAC_OutputBuffer_Enable;
   */
   DAC_Init(DAC_Channel_1, &DAC_InitStructure);
   DAC_Init(DAC_Channel_2,&DAC_InitStructure);

     /* Enable DAC Channel1 */
   DAC_Cmd(DAC_Channel_1, ENABLE);
   /* Enable DAC Channel2 */
   DAC_Cmd(DAC_Channel_2, ENABLE);
  
   //DAC_SetChannel2Data(DAC_Align_12b_R,0x7ff);//输出一半的基准电压
  DAC_DualSoftwareTriggerCmd(ENABLE);//使能软件触发,更新DAC的值


大家可以参考。

针对的开发板类型如下图所示:
http://item.taobao.com/item.htm?id=7734619451

1.JPG

图片附件: 1.JPG (2010-12-4 13:52, 21.27 KB) / 下载次数 359
http://bbs.hymcu.com/attachment.php?aid=623&k=d11b4f2bb525f4937bfb3f810bbdf06b&t=1732441267&sid=1rhTwU


作者: 模块化    时间: 2011-10-10 13:40

不管怎么说支持了










欢迎光临 珩源工控论坛 (http://bbs.hymcu.com/) Powered by Discuz! 7.2