Hi,
I have a couple MAX5724 8 channel 10 bit DAC's, i have it wired up correctly, however when ever i try to write a value to it doesn't seem to output anything. Either i misunderstood the datasheet in the wiring or im writing incorrectly to it. Since i have the LDAC connected to GND i think i can just use the CODEn command on page 21 of the datasheet.
A link to the datasheet:
http://datasheets.maximintegrated.com/en/ds/MAX5723-MAX5725.pdf
Here the code i use to write:
#include <SPI.h>
#define CS 52
void setup()
{
Serial.begin(115200);
SPI.begin(CS);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(CS, 1);
SPI.setClockDivider(CS, 3); // 28MHz
pinMode(CS, OUTPUT);
}
void loop()
{
digitalWrite(CS, HIGH);
digitalWrite(CS, LOW);
static int value = 1024;
if (value >= 1024)
{
value = 1024;
}
byte msg1 = 0b10001000;
byte msg2 = (byte)(value>>2);
byte msg3 = (byte)(value);
msg3 = msg3 | 0b00000011;
// byte msg1=0b01010100; // 01111111
// byte msg2=0b00000001; // 11111111
SPI.transfer(CS,msg1,SPI_CONTINUE);
SPI.transfer(CS,msg2,SPI_CONTINUE);
SPI.transfer(CS,msg3,SPI_LAST);
delay(4000);
}
wiring:
1 = 5V
2 - 9 = OUTPUT
10 = 5V
11 = 5V
12 = MOSI (middle pins)
13 = MISO (middle pins)
14 = SCK (middle pins)
15 = PIN 52
16 = OUTPUT
17 = 5V
18 = GND
19 = GND
20 = GND