saikiran@ees
Member level 3
Hi everybody
My problem is too much delay in my program even i entered the required condition.In below i posted the function that is using for updating the Digital Clock and i am not using interrupt.In below function i wrote some delay for taking the values from buffer and after that if i pressed entered it will show the updated clock or error without taking single second delay.But if reduce the delay the values will not read properly from buffer and when i pressed entered it taking 10 seconds delay for producing output.
Thank You.
My problem is too much delay in my program even i entered the required condition.In below i posted the function that is using for updating the Digital Clock and i am not using interrupt.In below function i wrote some delay for taking the values from buffer and after that if i pressed entered it will show the updated clock or error without taking single second delay.But if reduce the delay the values will not read properly from buffer and when i pressed entered it taking 10 seconds delay for producing output.
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 void update_time() { unsigned long int y=0,j=0; unsigned char hour,minute,second,temp_Buff[9]; unsigned char i=0,k,hh1,hh2,mm1,mm2,ss1,ss2; if(flag==1) printf("\nTime %02d:%02d:%02d", hr,min,sec); flag=0; if( U1RXREG == 'Y') { printf("\nEnter Hours,Minutes and Seconds like HH:MM:SS"); do { for(i=0;i<9;i++) { temp_Buff[i] = U1RXREG; for(y=0; y<65000; y++) for(j=0;j<=10;j++) Nop(); } hh1=temp_Buff[1]-48; hh2=temp_Buff[2]-48; mm1=temp_Buff[4]-48; mm2=temp_Buff[5]-48; ss1=temp_Buff[7]-48; ss2=temp_Buff[8]-48; hour=(hh1*10)+hh2; minute=(mm1*10)+mm2; second=(ss1*10)+ss2; } while(U1RXREG ==13); if(hour>23) printf("\nHour is not in range"); else hr=hour; if(minute>59) printf("\nMinute is not in range"); else min=minute; if(second>59) printf("\nSecond is not in range"); else sec=second; } U1STAbits.OERR=0; }
Thank You.
Last edited by a moderator: