0

我有一个带有 AD5791 和 LPC1768 的 VCO。我可以读写 AD5791 的 DAC 寄存器,但无法修改输出频率或电压。当 AD5791 直接连接到电源时,我可以按预期修改频率。因此,我认为这是一个软件问题。我的代码在这里:

#include "mbed.h"

SPI spi(p5, p6, p7); // mosi, miso, sclk
DigitalOut cs(p8);
DigitalOut LDAC(p9);
DigitalOut Reset(p11);
DigitalOut CLR(p10);

int main()
{
   spi.format(8,0);
   spi.frequency(10000); // you can speedup later
   cs = 1;

   Reset = 0;
   wait_us(1);
   LDAC = 0;
   CLR = 1;
   Reset = 1; // the chip is reset now

   cs = 0;
   spi.write(20);
   spi.write(0);
   spi.write(0);
   cs= 1; // this will activate dac

   cs = 0;
   spi.write(0x14);
   spi.write(0xCC);
   spi.write(0xCD);
   cs = 1; // set output register - shall output some value

   do{
   }while(1); // wait forever to test the output value

}

任何输入将不胜感激!谢谢!

4

1 回答 1

1

这里的主要问题是 LPC1768 在写入之前必须设置其软件控制寄存器和控制寄存器。此外,芯片必须由 LDAC 驱动,并在数据传输后暂停。这可以在我的代码中看到:https ://gist.github.com/tashwoods/84c81f87fa6e0f1b98a2

于 2014-05-06T15:14:17.840 回答