Other Parts Discussed in Thread: TCA6416
Tool/software:
Hi team,
Could you help provide sample code for the TCA6416A?
Thanks!
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.
Hi Zoe,
What are you using to program TCA6416A? Is it a TI processor or MCU?
Regards,
Tyler
Hi Tyler,
Here I use is x86 structure CPU.
The TCA6416 was used for 7-segment displayer in project, so I wonder whether need to initial TCA6416A first before display.
Have any sample code for reference?
Thanks.
Hello William,
We'll provide a response by EOD. Thank you!
Regards,
Josh
Hi William,
Does this mean you need assembly level code?
I don't think a simple platform like MSPM0, Arduino, ESP32 would help you or would it?
Regards,
Tyler
Hi Tyler,
I don't need assembly code, now BIOS follow efi structure it's mostly C code.
Thanks.
Hi William,
Some Pseudo code would look like:
Writes:
#define TCA6416A_address 0x20
void I2C_write(uint8 target_address, uint8 register_address, uint8 data){
//send start bit
//send target address + write bit (0) = 0x20
//send register address = 0x00 - 0x07 (look at register map on table 8-4)
//send data (to be shifted into register)
//send stop bit
}
Reads:
uint8 I2C_read(uint8, target_address, uint8_register_address){
uint8 read_data;
//send start bit
//send target address + write bit (0) = 0x20
//send register address = 0x00 - 0x07 (reg map on table 8-4)
//repeated start
//send target address + read bit (1) = 0x21
//read_data = next 8-bits following the ACK bit from previous transaction
return read_data;
}
I am following figure 8-9 and 8-10

Regards,
Tyler
Hi William,
You're welcome! Thank you for your questions. If you have any additional, please submit a new question!
Regards,
Tyler
Hi Tyler,
As the same purpose for 7-segment displayer, I try to issue the 0x02 cmd for Output Port 0/1, but the LED pins do not be pulled high.
If I need to light up all the LEDs (P0_0-7 and P1_0-7), the whole command should be { 0x40, 0x02, 0xFF, 0xFF }, is it right?
Hi William,
0x40, 0x02, 0xFF, 0xFF - sets the bits in the output port register which refers to the logic that each Pxx configured as OUTPUT will drive.
You must configure the Pxx as outputs first on port 0. The default state of P00 - P07 = INPUT. The command would look something like this:
0x40, 0x06, 0x00, 0x00 (sets port 0 and port 1 gpio's direction to OUTPUT).
0x40, 0x02, 0xFF, 0xFF (drives port 0 and port 1 OUTPUTs = HIGH).
Regards,
Tyler