I want to write a code to control a real time clock(RTC) IC. The RTC uses I2C communication and it act as a slave. my micro-controller is the host. I find a library from the web for doing the I2C communication.
The function for writing data is :
char I2C_Send(char Address,char *Data,char Num)
The (Address) is the I2C device address and it is fixed. The char pointer(*Data) is the input of the first data that will be send to the slave. The Num is the number of bytes that will be sent.
Firstly, I need to send a register address(reg_addr) to the RTC. So I write something like: