chenli829 发表于 2013-8-24 21:21:37

TLC5620问题

我在VrefA~D 上给上一个5V或9V电压,程序中将第三位置为1,结果,传入0x1ff,结果输出值总是为4.2V,请教是怎么回事,
代码如下
void Wait(unsigned char x)
{   
   unsigned char i;   
   for(i=0;i<x;i++);   
}   
   
void dacck(void)
{   
   DAC_CLK=1;
   Wait(2);   
   DAC_CLK=0;
   Wait(2);   
}   

void TLC5620_WriteDac(unsigned int x)   
{
        unsigned char i;
        unsigned int ch=x << 5;
       
        DAC_LDAC = 1;
        DAC_LOAD=1;   
       
        for (i=0; i<11; i++)
        {
                ch=ch<<1;
                DAC_DATA=CY;
                dacck();
        }   
   DAC_LOAD=0;
   Wait(2);
   DAC_LOAD=1;
   Wait(2);   
   DAC_LDAC = 0;
   Wait(2);   
   DAC_LDAC = 1;
}

void main()
{
        unsigned char a;
        P26 = 0;
        //P25 = 0;
        TLC5620_WriteDac(0x01ff);
        while(1)
        {
}
页: [1]
查看完整版本: TLC5620问题