Raady Here
Full Member level 5
Cannot display properly on LCD
Hi,
I am trying to update time on LCD,
a structure ClockTime has variable Seconds, Minutes and Hours.
XLCDCommand and XLCDPutRamString are default syntax for command mode and send string to LCD respectively given by Microchip.
I wrote a loop as below
No Time is being displayed.
I tried converting int to char in three ways
(char) i
i + '0'
i + 48
but nothing works :-x
where can I be wrong ??
I have warning as
timer.c:64: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
timer.c:69: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
timer.c:74: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
Hi,
I am trying to update time on LCD,
a structure ClockTime has variable Seconds, Minutes and Hours.
XLCDCommand and XLCDPutRamString are default syntax for command mode and send string to LCD respectively given by Microchip.
I wrote a loop as below
No Time is being displayed.
I tried converting int to char in three ways
(char) i
i + '0'
i + 48
but nothing works :-x
where can I be wrong ??
Code:
unsigned char Clock(void)
{
if (ClockTime.Seconds < 59 ){ // to check if seconds < 59?
Delay_10ms(100); // Delay of 1 sec
++ClockTime.Seconds; // update seconds
}
else { // if seconds => 59
ClockTime.Seconds = 0; // seconds = 0 and check minutes
if ( ClockTime.Minutes < 59 ) // if check minutes < 59?
++ ClockTime.Minutes; // updates minutes
else // if minutes => 59
{
ClockTime.Minutes = 0; // minutes = 0 and check hours
if ( ClockTime.Hours < 23 ) // check if hours < 23
++ClockTime.Hours; // update hours
else ClockTime.Hours = 0; // Reset time
}
}
XLCDCommand(0xC8);
XLCDPutRamString((char)ClockTime.Hours);
XLCDCommand(0xCA);
XLCDPutRamString(":");
XLCDCommand(0xCB);
XLCDPutRamString(ClockTime.Minutes+'0');
XLCDCommand(0xCD);
XLCDPutRamString(":");
XLCDCommand(0xCE);
XLCDPutRamString(ClockTime.Seconds+48);
}
I have warning as
timer.c:64: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
timer.c:69: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
timer.c:74: warning: passing argument 1 of 'XLCDPutRamString' makes pointer from integer without a cast
Last edited: