Hello,
I'm trying to interface DAC8531 with Arduino Mega trough three-wire serial interface (SPI).I've done all the connections and the sketch in ARDUINO IDE to write the values between 0 and 65535 (the input shift register of the DAC is 24 bits wide, the first six bits are “don’t cares”, the next two bits (PD1 and PD0) are control bits, the next 16 bits are the data bits-these are transferred to the DAC register on the 24th falling edge of SCLK.)
Here is the link for the datasheet of the DAC : http://www.ti.com/lit/ds/sbas192b/sbas192b.pdf
The program is:
#include "SPI.h"
int dacCSpin = 53, i;
byte data1 = 0, data2 = 0;
void setup() {
pinMode(dacCSpin, OUTPUT);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE1);
}
void loop() {
for ( i = 0; i < 65355; i = i + 10) {
data1 = highByte(i);
data2 = lowByte(i);
digitalWrite(dacCSpin, LOW);
SPI.transfer(0b00000000);
SPI.transfer(data1);
SPI.transfer(data2);
digitalWrite(dacCSpin, HIGH);
Serial.print("sent to DAC: ");
Serial.print(i);
Serial.print(" in binary: ");
Serial.println(i, BIN);
Serial.println(" ");
}
delay (11000);
}
With this program I can see on the oscilloscope the three SPI signals that Arduino initiates but still can not write anything in the memory of the DAC.
SPI CLOCK with SPI MOSI
SPI SS-SPI MOSI
Vout DAC with SPI MOSI
Arduino's µc it's not writing in the DAC's buffer.
If someone has worked with this DAC, i would appreciate a few opinions and a little help if possible. Thanks a lot.