Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

failed to read DS1302 using pic 18f4550

Status
Not open for further replies.

ahmed osama

Full Member level 6
Full Member level 6
Joined
Jul 18, 2004
Messages
352
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,296
Location
Cairo, Egypt, Egypt
Activity points
2,652
i succeed to set time/date @ DS1302 but i failed to read time/date

Read1302( ) return noting ... zero !!!

i tried many things

any tips ???

Code:
unsigned char DS1302OutputByte(void) 	
{ 
    
    

    unsigned char i;
    unsigned char ACC =0;

      DS1302_IO_DIR =1;  //input

      // DS1302_CLK =0;
   
    for(i=0; i<8; i++)
    {
        ACC = ACC >>1;

        ACC = DS1302_IO;
  
        DS1302_CLK = 1;
        
        DS1302_CLK = 0;
    }
     
    return(ACC); 
}




Code:
unsigned char Read1302(unsigned char ucAddr)	
{
    unsigned char ucData;
    DS1302_RST = 0;
    DS1302_CLK = 0;
    DS1302_RST = 1;
    
    DS1302InputByte(ucAddr|0x01); //this i guess that it is working
 
    
    ucData = DS1302OutputByte();
    
    DS1302_CLK = 0;
    DS1302_RST = 0;
    
    return(ucData);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top