CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

7 segment seconds

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kamillas



Joined: 24 Oct 2011
Posts: 50

View user's profile Send private message

7 segment seconds
PostPosted: Sat Nov 12, 2011 6:56 am     Reply with quote

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]);
             
             }
}
 }
}
ERICOO



Joined: 13 Jun 2011
Posts: 14
Location: NIGERIA

View user's profile Send private message

PostPosted: Fri Nov 25, 2011 12:47 pm     Reply with quote

YOU DELAYED FOR 100ms for the unit digit. where is your delay for tenth digit?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group