This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

atmega 169p

i am writing the code on i2c communication but it's not communicating betwwen the atmega169p and blr24f(external eepeom) the codw shown below
#include<ioavr.h>
#include<stdio.h>
#include <intrinsics.h>
#include <TWI_Master.h>
//void write(unsigned char dadr,unsigned char mloc,unsigned char data);
void main(void)
{ unsigned int data=0x02,read; //unsigned int j=000000000; PORTE=(1<<5);//sda; PORTE=(1<<6);//scl; USICR=0XA3;//USICR |=(1<<5);START+TWO WIRE MODE USISR=0X9F;//USICR &=~(1<<4);

USICR|=(1<<7);//startbit=1 USIDR=0X0A;//device address //USIDR=(j&0xFF);//lowerbyte USIDR=0000; USIDR=data; USICR=(1<<5);//stop bit

/* USICR|=(1<<7);//startbit=1
USIDR=0X0B;//device address
//USIDR=(j&0xFF);//lowerbyte
USIDR=0002;
//USICR|=(1<<7);//startbit=1
read=USIDR;
USICR=(1<<5);//stop bit
*/ while(1);