欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標(biāo)題:
DAC 程序 TLC5615
[打印本頁(yè)]
作者:
haoren
時(shí)間:
2015-9-15 00:09
標(biāo)題:
DAC 程序 TLC5615
/****************************************************
程序功能 : 使用TLC5615進(jìn)行DA轉(zhuǎn)換
單位 : 桂林電子科技大學(xué) 電信 EDA工作室
程序說(shuō)明 : 本程序適應(yīng)于絕大多數(shù)沒(méi)有四線制SPI口的8051
單片機(jī),模擬一個(gè)接口,可根據(jù)實(shí)際情況修改四個(gè)
接口的地址即可實(shí)現(xiàn)移植,使用編譯器為keil c2
***************************************************/
#ifndef __DAC1615_H_
#define __DAC1615_H_ //定義開始
//***************************//
//*************************************//
#ifndef uchar
#define uchar unsigned char
#endif
//***************************//
#ifndef uint
#define uint unsigned int
#endif
#ifndef uint
#define uint unsigned int
#endif
//****************************//
sbit cs = P3^2; //片選
sbit clk = P3^3; //時(shí)鐘
sbit din = P3^4; //數(shù)據(jù)入口
sbit dout = P3^5; //數(shù)據(jù)出口
//****************************//
void delay(); //延時(shí)函數(shù)
void DA_Conver(unsigned int DA_Value);
//***********************************//
//*************************************//
void delay()
{
int i = 5;
while(i--);
}
/*------------------------------------------------------------- */
void DA_Conver(unsigned int DAValue)
{
unsigned char i;
DAValue <<= 6;
cs = 0; // 片選DA芯片
clk = 0; // 在以下12個(gè)時(shí)鐘周期內(nèi),每當(dāng)在上升沿的
// 數(shù)據(jù)被鎖存,形成DA輸出。在前10個(gè)時(shí)鐘
for(i = 0; i < 12; i++) // 內(nèi)輸入的是10位DA數(shù)據(jù),后兩個(gè)時(shí)鐘周期
{ // 為填充字節(jié)。
din = (bit)(DAValue & 0x8000); //
clk = 1; //
DAValue <<= 1; //
clk = 0;
}
cs = 1; // CS的上升沿和下降沿只有在clk為低的時(shí)候
clk = 0; // 才有效
}
#endif //結(jié)束定義
作者:
18877546144
時(shí)間:
2016-5-31 22:23
加填充位有什么用,不加可以嗎,新手,求解釋
歡迎光臨 (http://m.raoushi.com/bbs/)
Powered by Discuz! X3.1