
#include<I2C.h>
#include<generic.h>

void main()
{
char BYTE_GET = 0x00,DATA_ = 0x11;
GREEN_LED = 0;//Just An indication for my hardware
YELLOW_LED = 0;//Just An indication for my hardware
sec_wait(1);
GREEN_LED = 1;//Just An indication for my hardware
YELLOW_LED = 1;//Just An indication for my hardware
sec_wait(1);
/********WRITE TO ADDRESS********/
i2c_transmit_start();
i2c_transmit_byte(0xA0);

i2c_transmit_byte(0xAA);//First word address
i2c_transmit_byte(0xAA);//Second word address

i2c_transmit_byte(DATA_);
i2c_transmit_stop();

/********READ FROM ADDRESS*******/
i2c_transmit_start();
i2c_transmit_byte(0xA0);

i2c_transmit_byte(0xAA);//First word address
i2c_transmit_byte(0xAA);//Second word address

i2c_transmit_start();
i2c_transmit_byte(0xA1);
BYTE_GET = i2c_receive_byte(I2C_NAK);
i2c_transmit_stop();

if(BYTE_GET == DATA_)//here we compare the data that was written to that we received.
	GREEN_LED = 0;//GREEN indication if they match
else
	YELLOW_LED = 0;//YELLOW if they do not match
sec_wait(1);
GREEN_LED = 1;
YELLOW_LED = 1;
sec_wait(1);
DATA_ ++;//now i increment the data so that the next time this incremented character is written
}
