john_galt wrote:Mick,
Could you pleas share your modified "tsaselect" function? I'm having a heck of a time
getting mine to work.
Thank you,
Doug
Doug,
This is what I got working
void tcaselectmc2(int8_t i){
if (i > 7) return;
if (i < 0){
Wire.beginTransmission(TCAADDRMC2);
Wire.write(0);
Wire.endTransmission();
return;
}
Wire.beginTransmission(TCAADDRMC2);
Wire.write(1<<i);
Wire.endTransmission();
}
I changed the function variable from uint8_t to int8_t so it will take a negative value. I have three MUX in my project and this is for mux2 every time I want to activate one for the channels on mux2 I pass the value (o to 7) and pass (-1) to the other two mux to deactivate them.
void MuxPortDeactivator (int port){
switch(port){
case 1:
tcaselectmc2(-1);
tcaselectmc3(-1);
break;
case 2:
tcaselectmc1(-1);
tcaselectmc3(-1);
break;
case 3:
tcaselectmc2(-1);
tcaselectmc1(-1);
break;
}
}
I call this function every time I want to change the multiplexer I'm going to read and pass the number of the mux I want to read so the other two get deactivated.
Hope this helps.
Cheers.