Go Down

Topic: I2C interface with DAC6573- RESOLVED (Read 1 time) previous topic - next topic

ichris93

Jan 19, 2013, 07:21 am Last Edit: Jan 21, 2013, 09:29 pm by ichris93 Reason: 1
Hi guys,

I am trying to communicate with a DAC6574 but I get the same I2C sequence no matter how I change the code. It looks like the attached image.



Do you need the code for it?  This is the Arduino sketch
Code: [Select]

#include <Wire.h>
#include <DAC6573.h>

DAC6573 myDAC6573(DAC6573_DEFAULT_ADDRESS);

void setup() {
   Wire.begin(); //Start the I2C bus
   Serial.begin (9600);
}

void loop()
{
 byte channel=1;
 static word DAC;
 static int delta=10;
 Serial.print("DAC");
 Serial.println(DAC);
 delay(100);
 
 myDAC6573.DAC6573_SetChannel(DAC,channel);
 DAC=DAC+delta;
 if (DAC > 1020) {delta = -10;}
 if (DAC < 20) {delta = 10;}
 
}
 


I will post library too if it is needed.

robtillaart

Where do you read the value of the DAC?
Which statement does that?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

PaulS

If you include header files in the library header file, it is not necessary to include them in the library source file, too.

ichris93


Where do you read the value of the DAC?
Which statement does that?



I set the value.

robtillaart

Sorry, stupid slip of the mind  :smiley-red:
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ichris93


If you include header files in the library header file, it is not necessary to include them in the library source file, too.


That wouldn't create a problem though, right?

ichris93


robtillaart

Lets try another "stupid "question ;)

How are the address lines of the chip connected?
Are they GND?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ichris93


Lets try another "stupid "question ;)

How are the address lines of the chip connected?
Are they GND?


If "stupid" questions get me to a solution, it is no problem ;)

Yes, they are all connected to GND.

ichris93

I got it working by changing the A0 pin to 5V and then changing the address.

Thanks guys.

robtillaart

one question remains, could you test:

If you GND both address lines and you use the I2C scanner of nick Gammon, does it find the device?
similar for other address pin combinations (high/low)?

- http://www.gammon.com.au/forum/?id=10896 - search for scanner (~@ 80% of the page)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ichris93


one question remains, could you test:

If you GND both address lines and you use the I2C scanner of nick Gammon, does it find the device?
similar for other address pin combinations (high/low)?

- http://www.gammon.com.au/forum/?id=10896 - search for scanner (~@ 80% of the page)



Thank you for the source.  Yes it does find it with all of them low and the same address, so I do not know why it didn't work with all of them low. 

robtillaart

loose connections, happens all around the world ;)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

ichris93


loose connections, happens all around the world ;)


No, because it doesn't work with that address. It finds it, but doesn't communicate properly.

Papa G

Please publish a link to the library.

Go Up