-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
47 lines (44 loc) · 835 Bytes
/
main.c
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
/*
* main.c
*
* Created on: Sep 12, 2022
* Author: Mohamed Nabil
*/
//will define here the time in seconds and minutes
unsigned char seconds = 0;
unsigned char minutes = 0;
unsigned char hours = 0;
#include"./headerFiles/header.h"
int main(void)
{
//initializations
//[1] : seven segment
initSevenSegment();
//[2] : timer
initTimer1_compareMode();
//[3] : interrupts
initInterrupt0_1_2();
//main code
while(1)
{
//the only code will while contain is display on seven segments
enable(0x01);
display(seconds%10);
_delay_ms(2);
enable(0x02);
display(seconds/10);
_delay_ms(2);
enable(0x04);
display(minutes%10);
_delay_ms(2);
enable(0x08);
display(minutes/10);
_delay_ms(2);
enable(0x10);
display(hours%10);
_delay_ms(2);
enable(0x20);
display(hours/10);
_delay_ms(2);
}
}