一部分学习资料
DAC902电路原理图如下:
DAC902引脚图:
DAC902管脚功能定义:
单片机源程序如下:
- /**********************************************************
- 康威电子
- 功能:利用DAC902模块产生一个电压
- 接口:
- PC12 -> DAC902_PowerON
- PA04 -> DAC902_CLK
-
- PC00 -> D11
- PC01 -> D10
- PC02 -> D09
- .
- .
- .
- PC09 -> D02
- PC10 -> D01
- PC11 -> D00
- 版本:1.0
- 硬件平台:康威数采驱动板
- 作者:康威电子
- 其他:
- **********************************************************/
- #include "stm32_config.h"
- #include "stdio.h"
- # include <DAC902.h>
- #include "timer.h"
- int main(void)
- {
- MY_NVIC_PriorityGroup_Config(NVIC_PriorityGroup_2); //设置中断分组
- delay_init(72); //初始化延时函数
- DAC902_Init();
- delay_ms(300);
- DAC902WriteData(4095);
- DAC902WriteData(0);
- while(1);
- }
复制代码
- # include <DAC902.h>
- # include <stdio.h>
- void DAC902_IO_Init(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure ;
-
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOC, ENABLE); //使能PB,PE端口时钟
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0| GPIO_Pin_1| GPIO_Pin_2| GPIO_Pin_3| GPIO_Pin_4| GPIO_Pin_5| GPIO_Pin_6| GPIO_Pin_7| GPIO_Pin_8| GPIO_Pin_9| GPIO_Pin_10| GPIO_Pin_11| GPIO_Pin_12 ;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_Init(GPIOC ,&GPIO_InitStructure) ;
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
- GPIO_Init(GPIOA ,&GPIO_InitStructure) ;
- }
- void DAC902WriteData(u16 dat)
- {
- u16 io;
- DAC902_CLK = 1;
- io = GPIO_ReadOutputData(GPIOC);
- io &= 0xf000;
- io = ((dat&0x0fff)|io);
- GPIO_Write(GPIOC, io);
- DAC902_CLK = 0;
- }
- void DAC902_Init(void)
- {
- DAC902_IO_Init();
- DAC902_CLK = 0;
- DAC902_PowerON();
- DAC902WriteData(4095);
- DAC902WriteData(4095);
- }
复制代码
所有资料51hei提供下载:
Q74--DAC902驱动程序 高速DA数模转换模块 原理图 资料-V0.2.zip
(1.43 MB, 下载次数: 105)
|