I have interfaced pcf8563 chip with my atmega8( 8Mhz freq). I would like to transmit date and time on hyperterminal using UART.
I am using code vision avr cross compiler for programming.
It provides me ready to use functions to get date and time for pcf8563. I am able to successfully read & transmit( through UART) the time , but my problem is with Date:
1. I have set the date using function
rtc_set_date(21, 2, 9);
Even used variables to do the same
2. To get the date :
rtc_get_date(&read_date, &read_month, &read_year);
All the variables are unsigned char type
I get correct values of read_date and read_month which I am successfully transmitting through UART.
But I am getting strange value (;7 on hyperterminal) for the read_year(which is set as 9)
3.I am converting date and time parameters to ascii using following piece of code:
unsigned char msb_byte=0, lsb_byte=0;
// convert data value to ascii
msb_byte = (( data/10) |0x30);
lsb_byte = ((data%10) |0x30);
// transmit ascii value of msb byte
Question: What could be the problem?
1. Whether I am getting wrong year value after reading pcf8563?
2. Am I making mistake while transmitting year value?
3. How to resolve this issue?
Please help me.
Thanks in Advance