Forum Replies Created
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
luckyParticipant
Here in one wire communication , i need to give delay in microseconds like some times i need to provide 10 micro seconds delay ,Is it possible to produce such a delays…
luckyParticipantOk,
i will try with proper hardware…
Thanks & Regards,
lucky
luckyParticipantHi,
void main(){unsigned char i,dat[5];reset();write_byte(0xCC); //skip rom commandwrite_byte(0x0F); //write scratchpadwrite_byte(0x00); //TA1 – datawrite_byte(0x00); //TA2 – datawrite_byte(10); //data to memory location 0x10write_byte(14);reset();write_byte(0xCC); //skip rom commandwrite_byte(0xAA); //read scratchpad commandfor(i=0;i<5;i++){dat=read_byte();}reset();write_byte(0xCC); //skip rom commandwrite_byte(0x55); //copy scratchpadwrite_byte(0x00); //TA1 – datawrite_byte(0x00); //TA2 – datawrite_byte(0x01); //ending off setms_delay(5);reset();// while(1);}void reset(void){unsigned char presence;write0();ms_delay(500); //480write1();ms_delay(80); //70presence = read_bit();ms_delay(420); //410write1(); //– not required}void write_byte(unsigned char w_buff){unsigned char w_cnt = 0;// P3=w_buff;while(w_cnt<{// P2=w_buff;if(w_buff & 0x01) //to send LSB first{write1();}else{write0();}w_buff = w_buff >> 1;w_cnt++;}}unsigned char read_byte(void){unsigned char temp=0,r_cnt=0,r_buff;while(r_cnt<{temp = read_bit();if(temp){r_buff |= 1;}r_buff=r_buff << 1;r_cnt++;}P3=r_buff;return(r_buff);}void write0(void){ds=0;ms_delay(70); //actual delay 60usds=1;ms_delay(10);}void write1(void){ds=0;ms_delay(10); //actual delay 6usds=1;ms_delay(65); //actual delay 54us}unsigned char read_bit(void){unsigned char result;ds=0;ms_delay(10); //actual delay 6usds=1;ms_delay(19); //actual dealay 11usresult=ds;ms_delay(60); //sctual delay 45usreturn(result);}this is my code for writing data into memory, coming to circuit iam using proteus..in that i was connected data pin of eeprom to port pin and i was connected a pullup to that wire….. -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)