Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Digital clock

Status
Not open for further replies.

nurmohammad

Newbie level 1
Joined
Apr 24, 2015
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
0
Activity points
0


www.facebook.com/wholovesmicrocontroller

//My name is Nur mohammad..
// I am Bio-medical Engineer..
// I love micro-controller.....
// Micro-controller is my lover........
// I hope that she loves me.......
// This project name is Digital Clock..
// I use 7-segment Display...
// Micro-controller use Atmega32...


unsigned char hh=1,h=2,mm=5,m=9,ss=6,s=0;
unsigned char display[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
int i,a,b;
int n[10];
nur()

{


while(1)
{

for(a=1;a<330;a++)
{
delay_us(10);
PORTD=0b00111110;
PORTB=display;
delay_us(10);
PORTD=0b00111101;
PORTB=*(display+ss);
delay_us(10);
PORTD=0b00111011;
PORTB=*(display+m)|0b10000000;
delay_us(10);
PORTD=0b00110111;
PORTB=*(display+mm);
delay_us(10);
PORTD=0b00101111;
PORTB=*(display+h)|0b10000000;
delay_us(10);
PORTD=0b00011111;
PORTB=*(display+hh);
}
m++;
if(m>9){m=0;mm++;}
if(mm>5){mm=0;h++;}
if(hh==1){
if(h>2){
hh=0;h=1;
}
}

else if(h>9){h=0;hh=1;}

if(PINC6_bit==1)
{
//delay_ms(100);
void main();
//mohammad();
// PORTB=0x00;
//delay_ms(100);
//PORTB=0xFF;
// h++;
while(PINC6_bit==1);
}


// while(PINC7_bit==1);

}
}


void main()
{

DDC7_bit=1;
DDC6_bit=1;
DDRB=0xFF;
DDRD=0xFF;
PORTB=0xff;
PORTD=0x00;
// PINC7_bit=0;
///while(1)//{

while(1)
{


for(i=1;i<330;i++)
{
delay_us(49);
PORTD=0b00111110;
PORTB=display;
delay_us(49);
PORTD=0b00111101;
PORTB=*(display+ss);
delay_us(49);
PORTD=0b00111011;
PORTB=*(display+m)|0b10000000;
delay_us(49);
PORTD=0b00110111;
PORTB=*(display+mm);
delay_us(49);
PORTD=0b00101111;
PORTB=*(display+h)|0b10000000;
delay_us(49);
PORTD=0b00011111;
PORTB=*(display+hh);
}
s++;
if(s>9){s=0;ss++;}
if(ss>5){ss=0;m++;}
if(m>9){m=0;mm++;}
if(mm>5){mm=0;h++;}
if(hh==1){
if(h>2){
hh=0;h=1;
}
}

else if(h>9){h=0;hh=1;}

if(PINC7_bit==1)
{


//for(b=0;b>1000;b++)




nur();
// PORTB=0x00;
//delay_ms(100);
//PORTB=0xFF;
// h++;

}



//while(PINC7_bit==1);



}




//}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top