

I2C.C file

unsigned char i2c_transmit(unsigned char address, *transmit_bytes, uchar num_bytes_send);

{

  //extern unsigned char byte1, byte2;
  // if already busy then return current status
  if (i2cstatus & I2C_BUSY) return i2cstatus;

  // now we are busy performing a transfer
  i2cstatus = I2C_BUSYTX;

  // store slave address + W for use in ISR
  slaveaddress = address << 1;

  // transmit start condition
  STA = 1;

  // transmission started
  return I2C_OK;
}

=========================================================================
Defined in i2c.h file

extern unsigned char i2c_transmit(unsigned char address, *transmit_bytes[], uchar MAX_NUMBYTE_TX[]);
=========================================================================

Defined in IO.c file

uchar MAX_NUMBYTE_TX[] = {7};
=========================================================================

Defined in I/O.c

unsigned char transmit_bytes[] = {0,0,0,0,0,0,0};//Holds I2C data bytes
						 //only
						 //Not address
extern unsigned char MAX_NUMBYTE_TX[];

=========================================================================

called from main.c

MAX_NUMBYTE_TX[0] = 0; //Transmit 1 bytes of DATA ONLY on I2C  
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0x03);  // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY);	// wait until complete

MAX_NUMBYTE_TX[0] = 1;
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0x03, 0x04);  // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY);	// wait until complete

MAX_NUMBYTE_TX[0] = 2;
i2c_init(0x20, 0); //Set to master with address of 0x20, no general call
i2c_transmit(0x3B, 0xfe, 0x04, 0x05);  // enable mux channels 0-1
while (i2c_getstatus() & I2C_BUSY);	// wait until complete


