#include"commen.h"
#include"dac8043.h"
void dac8043(float x)
{
u16 tr_n;
uchar i;
if(x==1) tr_n=(u16)((4095.0*x)/3.53);//3.35为基准源
else tr_n=(u16)((4096.0*x)/3.53);
ld_RESET;
for(i=0;i<=11;i++)
{
clk_RESET;
delay(5,1);
if(tr_n&0x800)
{
SRI_SET;
}
else
SRI_RESET;
tr_n<<=1;
clk_SET;
delay(10,20);
clk_RESET;
delay(5,1);
}
ld_SET;
delay(10,20);
}
void delay(uint x,uint y)
{
uint i,j;
for(i=0;i<=x;i++)
for(j=0;j<=y;j++);
}
- 1
- 2
- 3
前往页