Based on this code for reading a word from a register
int fetchWord(byte func)
{
i2c_start(deviceAddress << 1 | I2C_WRITE); //Initiates a transfer to the slave device with the (8-bit) I2C address addr.
//Alternatively, use i2c_start_wait which tries repeatedly to start transfer until acknowledgment received
//i2c_start_wait(deviceAddress<<1 | I2C_WRITE);
i2c_write(func); //Sends a byte to the previously addressed device. Returns true if the device replies with an ACK.
i2c_rep_start(deviceAddress << 1 | I2C_READ); //Sends a repeated start condition, i.e., it starts a new transfer without sending first a stop condition.
byte b1 = i2c_read(false); //i2c_read Requests to receive a byte from the slave device. If last is true,
//then a NAK is sent after receiving the byte finishing the read transfer sequence.
byte b2 = i2c_read(true);
i2c_stop(); //Sends a stop condition and thereby releases the bus.
return (int)b1 | ((( int)b2) << 8);
}
You can try this code to write a word to a register
void writeWord(byte func, int data)
{
i2c_start(deviceAddress << 1 | I2C_WRITE);
i2c_write(func);
i2c_write((data >> 8) & 0xFF)); //hi byte
i2c_write(data & 0xFF); //loByte
i2c_stop();
}
If you read the cycles with
Serial.print("Cycle Count: " );
Serial.println(fetchWord(CYCLE_COUNT));
The I think you would use
writeWord(CYCLE_COUNT, 0)//reset cycle count to 0