i want to write a code for my LCD to display real time information...i'm considering using a timer1 interrupt to update my display but i have no clue how to achieve that!. any suggestions?
Just generate a regular interrupt (I would use tmr2), say every 10mS, and increment a counter in the ISR. When the counter reaches 100, then increment the seconds counter and set a flag to show it's changed. The main program just needs to check the flag, and update the display when the flag is set, then clear the flag again. The ISR obviously keeps a count of minutes and hours as well.
Just generate a regular interrupt (I would use tmr2), say every 10mS, and increment a counter in the ISR. When the counter reaches 100, then increment the seconds counter and set a flag to show it's changed. The main program just needs to check the flag, and update the display when the flag is set, then clear the flag again. The ISR obviously keeps a count of minutes and hours as well.
Flow chart your problem...it invariably leads you to workable ideas
The lcd initialisation routine is generally the bit most folks get wrong in my experience (assuming a standard 2*20 type lcd module) but a quick look at any of the datasheets will quickly show you the order of things.
As Nigel pointed out, just set a free running timer, set up for the period you require. Set it up so that it overflows and sets an interrupt flag. Your main body of code then spends it's time reading your ADC and storing the latest values. After each pass, simply check for the interrupt flag having been set, if so send your output to the display routine you are using for output to the lcd, then clear the flag and go back to reading your ADC again etc.
Whatever the period you set your timer for, obviously it has to be long enough for the user to clearly see what is being displayed, no point in it updating faster than you can absorb what you see.