Go Down

Topic: Quad 12-bit DAC MCP4728 problem (Read 571 times) previous topic - next topic

clockworkrobot

Hi, I've been trying to get a "GY MCP4728" break out board to work.
https://www.aliexpress.com/i/32975204887.html

I've not been able to find any info on the particular board but with a little guesswork...
I'm connecting it to a 5v ATMega 328P Arduino Mini Pro.
I've connected CL to SCL, DA to SDA, R to GND and I've left L hanging.

I've installed this library:
https://github.com/hideakitai/MCP4728
and tried to compile the example sketch.

First problem. At  "Wire.begin(21, 22);"  I get the following error:



Arduino: 1.8.7 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

/var/folders/cd/qk843k6s1zg29k1shf789pfh0000gn/T/arduino_modified_sketch_754247/example.ino: In function 'void setup()':
example:10:22: error: no matching function for call to 'TwoWire::begin(int, int)'
     Wire.begin(21, 22);
                      ^
In file included from /var/folders/cd/qk843k6s1zg29k1shf789pfh0000gn/T/arduino_modified_sketch_754247/example.ino:1:0:
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:52:10: note: candidate: void TwoWire::begin()
     void begin();
          ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:52:10: note:   candidate expects 0 arguments, 2 provided
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:53:10: note: candidate: void TwoWire::begin(uint8_t)
     void begin(uint8_t);
          ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:53:10: note:   candidate expects 1 argument, 2 provided
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:54:10: note: candidate: void TwoWire::begin(int)
     void begin(int);
          ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/Wire.h:54:10: note:   candidate expects 1 argument, 2 provided
exit status 1
no matching function for call to 'TwoWire::begin(int, int)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




So to be honest i don't understand any of that but i took a look at the sketch in the examples folder on the github page and noticed that line of code was different. It reads "Wire.begin();" instead of "Wire.begin(21, 22));".

That version of the code compiles, loads and runs on my arduino but it appears to lock up at "    dac.attatch(Wire, 14);".

It does run if a unplug the dac but that's no use :)

Can anyone spot any errors or make any suggestions to help me get this module running? Thanks.

Robin2

@clockworkrobot, you have posted a new question in a very old Thread so I have suggested to the Moderator to move you to your own Thread

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

clockworkrobot

I presumed this was the place as the library documentation references this thread but no need to move it as, not entirely sure why but I tried the code here:
https://forcetronic.blogspot.com/2019/03/tutorial-on-digital-to-analog.html
and again it wouldn't run, until i disconnected it from the computer then i noticed it was working fine.
I guess it was something to do with the serial out not playing nice with the i2c.
Thanks.

ballscrewbob

@clockworkrobot

TOPIC SPLIT
DO NOT HIJACK !

Could you take a few moments to READ THIS.
It will help you get the best out of the forum.

Bob.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Robin2

@clockworkrobot, I suggest you now edit your Original Post (in this Thread) and change the Title so it reflects the correct hardware for your question.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up