AnsweredAssumed Answered

AD5664R Internal Reference

Question asked by yghan21c on Feb 21, 2011
Latest reply on Feb 22, 2011 by MMA

Hi.

I used AD5664R output reference(default setting) on ADuC7020 platform.

I want to change internal reference AD5664R on ADuC7020.

That's very easy. But, I cannot do because i confuse its datasheet.

the follows is AD5664R internal reference code that i changed.

How can I change this code for AD5664R internal reference?

Have you any test source code?

I think that I must be wrong with this code.

Plz Help me...ㅜㅜ

 

{
GP1CON |= 0x02020000;
GP1DAT |= 0x08000000;//Port 1.3 SPI CS configured as output (use mask 0x00080000 to switch it)
GP1SET = SPI_DAC_CS;//SPI CS -> High (SPI DAC @ Hi-Z mode)
SPICON = 0x0047;//0x17CF;//0x014F;
SPIDIV = 0x09;
for (int i = 100; i > 0; i--) {};//Waiting for SPI to initialize

//Reset SPI_DAC
GP1CLR = SPI_DAC_CS;//Assert CS
for (int i = 50; i != 0; i--) {};
SPITX = 0x20;
while (!(SPISTA & 0x08));
SPITX = 0x00;
while (!(SPISTA & 0x08));
SPITX = 0x00;
while (!(SPISTA & 0x08));
GP1SET = SPI_DAC_CS;//Deassert CS

// Software Reset Command
GP1CLR = SPI_DAC_CS;//Assert CS
for (int i = 50; i != 0; i--) {};
SPITX = 0x2F;
while (!(SPISTA & 0x08));
SPITX = 0x00;
while (!(SPISTA & 0x08));
SPITX = 0x01;
while (!(SPISTA & 0x08));
GP1SET = SPI_DAC_CS;//Deassert CS

// Internal Reference Setup
for (int i = 100; i > 0; i--) {};
GP1CLR = SPI_DAC_CS;
for (int i = 50; i != 0; i--) {};
SPITX = 0x3F;
while (!(SPISTA & 0x08));
SPITX = 0x00;
while (!(SPISTA & 0x08));
SPITX = 0x01;
while (!(SPISTA & 0x08));
GP1SET = SPI_DAC_CS;

//Configure SPI_DAC to ignore !LDAC signal (Sinchronous update mode)
for (int i = 100; i > 0; i--) {};//tiny timeout
GP1CLR = SPI_DAC_CS;
for (int i = 50; i != 0; i--) {};
SPITX = 0x30;
while (!(SPISTA & 0x08));
SPITX = 0x00;
while (!(SPISTA & 0x08));
SPITX = 0x0F;
while (!(SPISTA & 0x08));
GP1SET = SPI_DAC_CS;
}

Outcomes