WifWaf / TCA9548A

TCA9548A library for Arduino devices (supports multiple channels).
Apache License 2.0
20 stars 12 forks source link

problem in using the TCA9548A to control multiple DAC #2

Closed delcasso closed 4 years ago

delcasso commented 4 years ago

Hi, I am trying ti set up a ArduinoMega-TCA9548A-MCP4725(DAC) chain I am struggling a lot with the code of the chain. I hope you will find my mistake

I know both devices are working because I can talk to them independently via ArduinoMega-I2C

I got inspiration fro; these two internet pages https://forums.adafruit.com/viewtopic.php?f=22&t=93035 https://learn.sparkfun.com/tutorials/mcp4725-digital-to-analog-converter-hookup-guide/all

Thanks a lot

Sebastien

Here is my arduino code

byte Program = 64; byte DAC_addr = 0x62; // This hardwired into the IC and the BoB, in other words, it is a given. byte Multiplexer_addr = 0x70; byte TargetID = 0; byte b1 = 0; byte b2 = 0; int value = 0;

include

void setup() {   value = 0     b1 = byte((value / 16));   b2 = byte(value % 16);   Wire.beginTransmission(TCAADDR);   Wire.write(1 << TargetID);   Wire.write(DAC_addr);   Wire.write(Program);   Wire.write(b1);   Wire.write(b2 << 4); // Needed twice, since the 4 lowest bits (of 12) are in the fourth byte   Wire.endTransmission();   }

void loop() {   }

Delcasso Sebastien Research Scientist 0033 5 5757 4062 NEUROCENTRE MAGENDIE - U1215 146, rue Léo saignat 33077 Bordeaux cedex,France