kamillas
Joined: 24 Oct 2011 Posts: 50
|
7 segment seconds |
Posted: Sat Nov 12, 2011 6:56 am |
|
|
hello, I made a circuit 7segment display, and I want to display a rotation time (seconds) from 0 seconds to 60 seconds but I found a calculation problem, I have 01 seconds between each display, and when the the display shows the number 9 after it displays the number 0, not 10, 11, 13 ..... so help me
Code: | #include <16F877A.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#use delay(clock=40000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
void main(){
int unit,dec;
char display_digit[10]= {0xbF,0x6,0x5b,0x4f,0x66,0x6D,0x7D,0x7,0x7f,0x6F};
while (1)
{
OUTPUT_B(0x00);
OUTPUT_A(0xFF);
for (Dec=0;Dec<=5;++Dec)
{
for (unit=0;unit<=9;++unit)
{
OUTPUT_A(0x01);
OUTPUT_B(display_digit[unit]);
delay_ms( 100 );
if (Dec==0) output_high(PIN_A1);
else OUTPUT_A(0x02);
OUTPUT_B(display_digit[dec]);
}
}
}
} |
|
|