一部分學習資料
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)
2018-7-19 17:45 上傳
點擊文件名下載附件
|