Your question is nice and good choice for project, because you can learn a lot with this simple project. But, you must give us a few more details about your project.
1. you want to build digital clock, but what you will use like a hardwer - RTC (Real Time Clock), or you will use timer interupt routine every seconds?
2. will you represent time on seven segment display or you will use some LCD display? (I agree this question is not unnecessary to be answered before starting to write code for digital clock)
Here is
only simple example for algoritm for thinking about this task:
Code:
// variables
int second = 0;
int minute = 0;
int hour = 0;
// timer interupt routine
timer_interupt()
{
second++; // increment seconds and check the value
if (second == 60) {
second = 0;
minute++;
}
if (minute == 60) {
minute = 0;
hour++;
}
if (hour == 25) {
hour = 0;
}
}