This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TCA9548A: How to select the slave channel through software

Part Number: TCA9548A
Other Parts Discussed in Thread: TM4C129XNCZAD,

Tool/software: Code Composer Studio

Hi,

We are using tm4c129xnczad controller  interfacing with the tca95485a device .In our project we are one master and multiple slaves  so here my doubt is how do I select the slave channel through the software . How do I program to select particular slave device.Plz help me with the solution.

  • Hey Chandana,

    Are you looking for a high level overview on how to use the TCA9548A? (Like a high level example code to enable a channel of the device?)

    Or are you looking for specific code from that processor for your application? (If so, I will see if I can reassign the thread to one of our experts on the processor instead)

    Thanks,

    -Bobby

  • Thanks for the reply.

    I am looking for high level example code on how to use the TCA9548A.

    Pleas help me with the solution.

  • #include I2C.library
    int TCA9548A_address = 0b1110100; //this is the 7 bit hardware address of TCA9548A if A0-A2 are GND
    
    
    void_example1{
    
    //Example to enable channel 5
    I2C.WriteTransmission(TCA9548A_address); 	//specifies what slave address to write to
    I2C.WriteByte(0b00100000);  			// bit 5 is set to 1 meaning channel 5 is enabled and all others disabled
    I2C.Send();					//Once code hits this line, the I2C communication is sent
    
    //you can now communicate to the slave on channel 5
    }
    
    void_example2{
    //example to read what TCA9548Achannel is enabled 
    I2C.ReadTransmission(TCA9548A_address, 1); 	//1 is how many bytes we want to read in this case, we only need 1 byte to see what ch is enabled
    I2C.Send();					//Once code hits this line, the I2C communication is sent
    
    //pretend we received data and now want to display to terminal
    print(I2C.ReadByte()); //prints what was received in the I2C buffer
    }

    Attached is a high level code example based on how an Atmega processor using an Arduino IDE would execute the code. Hopefully you find this useful.

    Thanks,

    -Bobby

  • Thanks for the support.

    I will check with that and get back to you  if any doubt is there.