Does this mean you've done something like this, to isolate the problem area?
Code:
void LCD_TimerDisp()
{
unsigned char alphabet;
unsigned char nonchar[8];
for(alphabet=0; alphabet<8; alphabet++)
{
nonchar[alphabet] = ' ';
}
do
{
// DS1302_GetTime(&CurrentTime);
// TimeToStr(&CurrentTime);
// DateToStr(&CurrentTime);
//!! If this doesn't work, there is something wrong
//!! with your display code.
CurrentTime.TimeString[0] = '1';
CurrentTime.TimeString[1] = '2';
CurrentTime.TimeString[2] = ':';
CurrentTime.TimeString[3] = '3';
CurrentTime.TimeString[4] = '4';
CurrentTime.TimeString[5] = ':';
CurrentTime.TimeString[6] = '5';
CurrentTime.TimeString[7] = '6';
LCD_command(0xc0);
for(alphabet=0; alphabet<8; alphabet++)
{
LCD_print(CurrentTime.TimeString[alphabet]);
}
LCD_command(0x06);
for(alphabet=0; alphabet<8; alphabet++)
{
LCD_print(nonchar[alphabet]);
}
delay(1000);
}
while(1);
}
void LCD_TimerDisp()
{
unsigned char alphabet;
unsigned char nonchar[8];
for(alphabet=0; alphabet<8; alphabet++)
{
nonchar[alphabet] = ' ';
}
do
{
// DS1302_GetTime(&CurrentTime);
//!! If this works, there is something wrong with your
//!! DS1302_GetTime input code.
CurrentTime.Hour = 12;
CurrentTime.Minute = 34;
CurrentTime.Second = 56;
TimeToStr(&CurrentTime);
DateToStr(&CurrentTime);
LCD_command(0xc0);
for(alphabet=0; alphabet<8; alphabet++)
{
LCD_print(CurrentTime.TimeString[alphabet]);
}
LCD_command(0x06);
for(alphabet=0; alphabet<8; alphabet++)
{
LCD_print(nonchar[alphabet]);
}
delay(1000);
}
while(1);
}
If so, what have you discovered?
It might be suspected that you're not allowing enough time in your various short delays to reliably read data from devices (or write data to them).
You've got a whole second before the display changes, so you can affort to be quite leisurely (say 50 milliseconds per read) to slowly gather all the data.