Dear All.
I want to control 10 bits DAC by Arduino using wire library.
I read the data sheet of the DAC53608 carefully and wrote the following code to get 5 volts.
#include <Wire.h>
byte DAC= 0x48; //DAC_Address
byte command;//Config_Device and Output_Address
byte data1;//Data_LSB
byte data2;//Data_MSB
void setup() {
Serial.begin(9600);
Wire.begin();
command=0x01;
data1=0x00;
data2=0xFE;
delay(2000);
Wire.beginTransmission(DAC);
Wire.write(command);
Wire.write(data1);
Wire.write(data2);
Wire.endTransmission();
Serial.println("Device Config is DONE");
}
void loop() {
command=0x08;
data1=0xff;
data2=0xff;
Wire.beginTransmission(DAC);
Wire.write(command);
Wire.write(data1);
Wire.write(data2);
Wire.endTransmission();
}
but there is no signal.
Does anyone face the same problem?
Salam_Alabassi:
the following code
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use [color = red]code tags [/color] (the </> icon above the compose window) to make it easier to read and copy for examination
See also FAQ - Arduino Forum for general rules on forum behavior and etiquette.
Hello,
Welcome to the Arduino Forum.
This guide explains how to get the best out of this forum. Please read and follow the instructions below.
Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frus…
JohnRob
December 18, 2021, 7:07pm
3
I'm not familiar with the DAC53608, however I suggest putting a delay in your loop to allow the DAC to respond.
Also I would try something at mid range instead of 0x0FF.
Thank you for your fast reply.
I tried with different values, different delays and different channel output , still no response.
JohnRob
December 18, 2021, 7:16pm
5
Sorry I couldn't be of more help.
Perhaps you should recheck your connections.
1 Like
Salam_Alabassi:
byte DAC= 0x48
According to the data sheet you should be sending LSB 0 for write 1 for read, for example
0b10010000 which is 0x90
you are sending
0b01001000 which is 0x48
Thank you for your reply.
actually, the LSB bit is included automatically, so I must send (0x48) but the device will send (0x90) as shown in the attached image.
actually found 2 example code for this DAC online
why not give those a go
example code 1
//DAC53608 Datasheet Programmable LED Biasing Application
#include <Wire.h>
//I2C address definitions
#define I2C_ADDR_ALO 0x48 //I2C address definitions
#define I2C_ADDR_AHI 0x49
#define I2C_ADDR_ASDA 0x4A
#define I2C_ADDR_ASCL 0x4B
void setup()
{
int MSB=0, LSB=0; //MSB, LSB variables for reading back registers
Serial.begin(9600);
Serial.print("Programming...");
Wire.begin(); // join i2c bus (address optional for master)
//Power-up the device and channels
//WRITE DEVICE_CONFIG(0x01), 0x0000
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x01)); // DEVICE_CONFIG Register
Wire.write(byte(0x00)); //
Wire.write(byte(0x00)); //
Wire.endTransmission(); // stop transmitting
//Program mid code (or the desired voltage) on all channels
//WRITE DACA_DATA(0x08), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x08)); // DACA_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACB_DATA(0x09), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x09)); // DACB_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACC_DATA(0x0A), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0A)); // DACC_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACD_DATA(0x0B), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0B)); // DACD_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACE_DATA(0x0C), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0C)); // DACE_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACF_DATA(0x0D), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0D)); // DACF_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACG_DATA(0x0E), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0E)); // DACG_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
//WRITE DACH_DATA(0x0F), 0x07FC //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x0F)); // DACH_DATA Register
Wire.write(byte(0x07)); //
Wire.write(byte(0xFC)); //
Wire.endTransmission(); // stop transmitting
Serial.println("Done");
void loop()
{
}
example code 2
//DAC53608 Datasheet Programmable Window Comparator Application
#include <Wire.h>
//I2C address definitions
#define I2C_ADDR_ALO 0x48 //I2C address definitions
#define I2C_ADDR_AHI 0x49
#define I2C_ADDR_ASDA 0x4A
#define I2C_ADDR_ASCL 0x4B
void setup()
{
int MSB=0, LSB=0; //MSB, LSB variables for reading back registers
Serial.begin(9600);
Serial.print("Programming...");
Wire.begin(); // join i2c bus (address optional for master)
//Power-up the device and channels
//WRITE DEVICE_CONFIG(0x01), 0x0000
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x01)); // DEVICE_CONFIG Register
Wire.write(byte(0x00)); //
Wire.write(byte(0x00)); //
Wire.endTransmission(); // stop transmitting
//Program 2.625V on channel A
//WRITE DACA_DATA(0x08), 0x0868 //10-bit MSB aligned
Wire.beginTransmission(I2C_ADDR_ALO);
Wire.write(byte(0x08)); // DACA_DATA Register
Wire.write(byte(0x08)); //
Wire.write(byte(0x68)); //
Wire.endTransmission(); // stop transmitting
Serial.println("Done");
void loop()
{
}
hope that helps...
1 Like
Thank you so much for your reply.
I tried with the two codes but still does not work.
I checked the connections, they are as following:
SDA->SDA
SCL->SCL
A0->GND
LDAC->GND
CLR->GND
Vref.in-> open circuit
Vdd->5V "from arduino"
GND->GND
//////////////////
can you share with me the link that you found the above code? to read it deeply .
I supporse you did you the notice the hyperlink then...
1 Like
not sure but IMO shouldn't LDAC, CLR be pulled up and NOT connected to GND...
(shows 3.3V here but according to datasheet 5V should also be ok)
hope that helps...
wait, you don’t have any voltage dividers on data lines? you are sending 5v to 3.3v chip?
my circuit is as an image below:
ok... at least that matches with schematic in reply #12 though that was NOT was you said in reply #9
1 Like
good catch!
hopefully OP will try the codes with the suggested 'default' connections before going any further...
1 Like
MarkT
December 21, 2021, 2:15pm
19
You must power the DAC from 5V if you connect 5V logic signals to it, otherwise it may be destroyed. The absolute maximum voltage on its input pins is 0.3V more than its Vdd voltage. Getting this wrong risks CMOS latchup and the whole chip cooking itself.
The DAC53608 is able to be powered from 5V.
1 Like
Hi.
Firstly, I connected the DAC with the Arduino and raspberry pi. and send the commands and got the same thing.
All output channels give 16 mV without enabling commands of the channels.
When I send the enable command to enable channel A, the voltage drops to 2.8 mV and others are still 16 mV.
And so on with enabling others channels but others channels drop to 0.2mV.
When I turn off the DAC, everything comes back to the original states.
I tried to read the register, there was no data always, received 0x0000.
That means, in my opinion, the enable command works perfectly but the register doesn't receive any data from our code.
Best Regards.