Hi Bigmac!.
I`m a little confused with the method you described to me because I have some routine inside my LCD printig function doing something like you are mentioning.
I show you here the 2 functions that I`m using for as follows:
void printf_LCD_4bits(unsigned char fila, unsigned char columna, char *texto,char value)
{
unsigned char adrs;
adrs = columna - 1;
if(fila == 2)
adrs = adrs | 0x40;
Ctrl4bits(adrs | 0x80);
while(*texto)
Datos4bits(*texto++);
Datos4bits(':');
Datos4bits( ((value%1000)/100)+0x30); <---look at this....
Datos4bits( ((value%100)/10)+0x30);
Datos4bits( (value%10)+0x30);
}
void main (void)
{
DDRA_DDRA4=1 ;
DDRB_DDRB4=1 ;
DDRB_DDRB5=1 ;
DDRB_DDRB6=1 ;
DDRB_DDRB7=1 ;
DDRC_DDRC0=1 ;
DDRC_DDRC3=1 ;
DDRC_DDRC4=1 ;
//EnableInterrupts; /* enable interrupts */
InitPLL();
Config_LCD_4bits();
Write_Control_reg(3); // squarewave output 32.768kHz at RTC SQW pin;
Init_Time_Default();
WriteRTC();
for(;

{
__RESET_WATCHDOG(); /* feeds the dog */
Hours = (ReadRTCbyte(2)+(0x30));
Minutes = (ReadRTCbyte(1)+(0x30));
Seconds = (ReadRTCbyte(0)+(0x30));
printf_LCD_4bits (1,1,"h",Hours);
printf_LCD_4bits (1,6,"m",Minutes);
printf_LCD_4bits (1,12,"s",Seconds);
//PTA = RD_data; // Show RTC info on LEDs;
//PTB = RD_data; // Show RTC info on LEDs;
//wait_time(250);
//asm nop;
} /* loop forever */
You suggested this:
void upper_char (char value);
{
return (value << 4 + 0x30);
}
void lower_char (char value);
{
return (value | 0F + 0x30);
}
The questions would be.....where sould I set the code you mentioned to process the incoming BCD chars?.
Thank you very very much Big!!!
Ganimides
Message Edited by ganimides on 05-17-200608:57 AM