Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/26/09 04:38
Read: times


 
#171177 - i2c used, What should be the address
Responding to: ???'s previous message
Dear Members,

According to the data sheet, I have to send a 2 byte address. Now i am using the i2c protocol(by Murray). Now my question is that to send a 2 byte address should i use the "i2c_transmit_byte" function two times.My main program looks like below


#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);//1 second delay
GREEN_LED = 1;//Just an indication for my hardware
YELLOW_LED = 1;//Just an indication for my hardware
sec_wait(1);//1 second delay

/********WRITE TO ADDRESS********/
i2c_transmit_start();
i2c_transmit_byte(0xA0);
i2c_transmit_byte(0xAA);//First Byte address
i2c_transmit_byte(0xAA);//Second Byte address
i2c_transmit_byte(DATA_);
i2c_transmit_stop();

/********READ FROM ADDRESS*******/
i2c_transmit_start();
i2c_transmit_byte(0xA0);
i2c_transmit_byte(0xAA);//First Byte address
i2c_transmit_byte(0xAA);//Second Byte address
i2c_transmit_start();
i2c_transmit_byte(0xA1);
BYTE_GET = i2c_receive_byte(I2C_NAK);

i2c_transmit_stop();

if(BYTE_GET == DATA_)//Comparing the data send to the data that is recieved
     GREEN_LED = 0;//GREEN glows if both are same
else
     YELLOW_LED = 0;//Yellow if both are different
sec_wait(1);
GREEN_LED = 1;
YELLOW_LED = 1;
sec_wait(1);
DATA_ ++;//data to be sent is incremented by one so that the next data send is different from the one that was sent last time.

 



List of 16 messages in thread
TopicAuthorDate
AT24C256            01/01/70 00:00      
   help            01/01/70 00:00      
   BitBang's Amost Always....            01/01/70 00:00      
   Why use void functions            01/01/70 00:00      
      thanks            01/01/70 00:00      
      Writing to specific address            01/01/70 00:00      
         Send sensible address values.            01/01/70 00:00      
   I2C_0.0.zip            01/01/70 00:00      
   no luck,            01/01/70 00:00      
      You have more pins to mis-wire.            01/01/70 00:00      
   i2c used, What should be the address            01/01/70 00:00      
      Read Murray's excellent Help Files            01/01/70 00:00      
   Incorrect reply            01/01/70 00:00      
      Please take some time to READ the Help            01/01/70 00:00      
   single byte read write working            01/01/70 00:00      
      I2C_0.1.zip released!            01/01/70 00:00      

Back to Subject List