ajit_nayak87
Member level 5
I have PIC18F24k40 with DS1307 RTC device. here is sample code i have shared here. I am facing actual while displaying parameter.
i am setting value of MIN_SET & SEC_SET =0X40 in decimal . if i use below instruction it properly increment . but in Run mode while displaying ,it display hexadecimal value 0X28
If i change below value it will display hexadecimal value after 40. if i set MIN_SET & SEC_SET =0X00 then properly increment. But for MIN_SET & SEC_SET=0X40
min paramter shows 0X40 and sec parameter display for 56 it shows 38
my code is code.txt file
i am setting value of MIN_SET & SEC_SET =0X40 in decimal . if i use below instruction it properly increment . but in Run mode while displaying ,it display hexadecimal value 0X28
Temp1= sec & 0x0f;Temp2= sec>> 4;
LEDBuffer_1[0] = DISPTABLE[Temp1];
LEDBuffer_1[1] = DISPTABLE[Temp2];
Temp3 = min & 0x0f;Temp4= min >> 4;
LEDBuffer_1[2] = DISPTABLE[Temp3];
LEDBuffer_1[3] = DISPTABLE[Temp4];
If i change below value it will display hexadecimal value after 40. if i set MIN_SET & SEC_SET =0X00 then properly increment. But for MIN_SET & SEC_SET=0X40
min paramter shows 0X40 and sec parameter display for 56 it shows 38
what are changes need to made to display actual value. Somewhere i need to convert bcd to decimal and decimal to Bcd conversionTemp1= sec & 0x0f;Temp2= sec>> 4;
LEDBuffer_1[0] = DISPTABLE[Temp1];
LEDBuffer_1[1] = DISPTABLE[Temp2];
Temp3 = min & 0x0f;Temp4= min >> 4;
LEDBuffer_1[2] = DISPTABLE[Temp3];
LEDBuffer_1[3] = DISPTABLE[Temp4];
my code is code.txt file