SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By saadabd
#197330
Hello Everyone, I am new in programming and i have to implement one project in which i am suppose to use a bi-polar DAC to generate +- 0 -> 5V triangular wave output at the frequency of 50mHz (milihertz). I tried going through the datasheet of DAC but i am not very confident in writing the code for. can anyone please help or share some sample code.
By saadabd
#197730
Thanks for your help, as i mentioned i am new in interfacing hardware.

I tried implementing this library with following configurations,

#include <AD5752.h>
#include<SPI.h>
//char slave_pin_DAC = 9; //it is already declared in .cpp file as pin 9
void setup() {
init_DAC(DAC_A, pn5V);
}

void loop() {
set_DAC_value(0XFF, 0xFF); //+5v
delay(1000);
set_DAC_value(0X00, 0x00); //-5v
delay(1000);
}

and i made the following pin configurations for mega
2scomp = gnd
sync = 9
sclk = sck
sdin = MOSI
Ddout = MISO
Ldac = gnd
Clr = gnd

DAC still not working, i looked at the data sheet but unable to use set_DAC_value( , ); command, i am hoping to see +5 -5v output.
By paulvha
#197744
Need to understand a bit more about your connections. Vdd, Rfin, AVdd etc. Is Ddout is SDO.

I have not studied the datasheet & code enough but one thing jumped out: You have CLR connected to ground. According to the datasheet : The outputs cannot be updated with a new value while the CLR pin is low. A clear operation can also be performed via the clear command in the control register. can you check that ?
By paulvha
#197763
As I find this an interesting project, I have created a library to connect an AD5752 / AD5732 or AD5722 to an Arduino based on the data-sheet from scratch. The library has not been tested as I do not have an AD57xx. I have ordered one AD5722 for testing that should arrive later this week.. but it might help you already. I have posted the first on https://github.com/paulvha/AD57xx. A zip file version has been added there as well (the installation of the has not been tested either yet )
By lyndon
#197764
Unless there is something particularly special about the AD5722, I'd suggest using a DAC that already has Arduino libraries and using an op-amp subtractor on the output to get the +/- signals. You'll need the op amp anyway, for just about any bipolar DAC.

This is pretty easy to use: https://www.sparkfun.com/products/12918