sonic05
Member level 1
12hours CLOCK program...
THE ic that i used is 16f877a...
anybody can help me for this program,..
#include<16f877.h>
#fuses XT,NOLVP,NOWDT,PUT
#use delay (clock=1M)
#byte port_d=8
#byte port_a=5
#byte port_c=8
byte CONST LED_MAP[10]={0x3F,0x06,0x5b,0x4F,0x66,0x6D,0x7D,0x07,0X7F,0x6 F};
void display_number(int32 j)
{
output_c(LED_MAP[j/600%10]) ;
output_low(PIN_A4);
delay_ms(2);
output_high(PIN_A4);
output_c(LED_MAP[j/60%10]) ;
output_low(PIN_A3);
delay_ms(2);
output_high(PIN_A3);
output_c(LED_MAP[j/10%6]) ;
output_low(PIN_A2);
delay_ms(2);
output_high(PIN_A2);
output_c(LED_MAP[j%10]);
output_low(PIN_A1);
delay_ms(2);
output_high(PIN_A1);
}
void main()
{
int32 m,count=0;
while(TRUE)
{
for (m=0;m<=10;m++)
display_number(count);
count=(count==3600)? 0:count+1;
}
}
i want to have a program like a 12hours clock [1][2]:[0][0] but idont know if it is possible to used this program because this program is for [6][0]:[0][0] stopwatch...
(LED_MAP[j%10]); and im also confuse in this part..
THE ic that i used is 16f877a...
anybody can help me for this program,..
#include<16f877.h>
#fuses XT,NOLVP,NOWDT,PUT
#use delay (clock=1M)
#byte port_d=8
#byte port_a=5
#byte port_c=8
byte CONST LED_MAP[10]={0x3F,0x06,0x5b,0x4F,0x66,0x6D,0x7D,0x07,0X7F,0x6 F};
void display_number(int32 j)
{
output_c(LED_MAP[j/600%10]) ;
output_low(PIN_A4);
delay_ms(2);
output_high(PIN_A4);
output_c(LED_MAP[j/60%10]) ;
output_low(PIN_A3);
delay_ms(2);
output_high(PIN_A3);
output_c(LED_MAP[j/10%6]) ;
output_low(PIN_A2);
delay_ms(2);
output_high(PIN_A2);
output_c(LED_MAP[j%10]);
output_low(PIN_A1);
delay_ms(2);
output_high(PIN_A1);
}
void main()
{
int32 m,count=0;
while(TRUE)
{
for (m=0;m<=10;m++)
display_number(count);
count=(count==3600)? 0:count+1;
}
}
i want to have a program like a 12hours clock [1][2]:[0][0] but idont know if it is possible to used this program because this program is for [6][0]:[0][0] stopwatch...
(LED_MAP[j%10]); and im also confuse in this part..