這是我寫的程式,編譯下載都是沒有問題的,就是輸出電壓一直為零,電路連線確定了好幾遍,沒有找到問題,請各位大神幫幫忙~
#include <reg51.h>
//-------------------------------------------------
//
//-------------------------------------------------
void delay();
void DA_Conver(unsigned long DAValue);
//--------------------------------------------------
//
//-------------------------------------------------
sbit cs =P1^0;
sbit clk =P1^1;
sbit din =P1^2;
sbit dout =P3^5;
//--------------------------------------------------
void main()
{
long DA_Value =128;
delay();
while(1)
{
DA_Conver(DA_Value);
delay();
da5615(DA_Value);
delay();
}
}
void delay()
{
int i = 5;
while(i--);
}
void DA_Conver(unsigned long DAValue)
{
unsigned char i;
DAValue <<= 6;
cs =0;
clk = 0;
for(i = 0; i < 12; i++){
din=(bit)(DAValue&0x8000);
clk = 1;
DAValue <<= 1;
clk = 0;
}
cs = 1;
clk = 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/52013.html
標籤:基礎類
上一篇:C++爬蟲崩潰問題
