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 support@ccsinfo.com

clock 7segment PIC16F877A

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



Joined: 05 Sep 2011
Posts: 8

View user's profile Send private message Send e-mail

clock 7segment PIC16F877A
PostPosted: Mon Sep 05, 2011 11:03 am     Reply with quote

help me

find in google do not have clock code of pic16f877a where not true

ask clock code for pic16f877a and pic simulation proteus

Crying or Very sad Crying or Very sad

or hex file and schematic design file of proteus

below copy from youtube





Code:


#include <16F877A.h>
#fuses XT,NOWDT,PUT,NOBROWNOUT,NOLVP
#use delay(clock = 4000000)
#byte PORTA=0X05
#byte PORTC=0x07
#byte PORTB=0X06
#define A0 PIN_A0
#define A1 PIN_A1
#define A2 PIN_A2
#define A3 PIN_A3
#define A4 PIN_A4

 int sec1,sec2,min1,min2,hour1,hour2;

int counter=125;
int flag=0;


const int table[10]={0b11000000,
            0b11111001,
            0b10100100,
            0b10110000,
            0b10011001,
            0b10010010,
            0b10000010,
            0b11111000,
            0b10000000,
               0b10010000};

void main()
{
PORTB=0X00;
PORTC=0X00;


set_tris_a(0xff);
set_tris_c(0x00);
set_tris_b(0x00);
set_RTCC(6);
setup_counters(RTCC_INTERNAL,RTCC_DIV_32);
enable_interrupts (INT_RTCC);
enable_interrupts (GLOBAL);

for(;;)
{
PORTB=table[sec1];
PORTC=0X01;
delay_ms(2);

PORTB=table[sec2];
PORTC=0x02;
delay_ms(2);

PORTB=table[min1];
PORTC=0x04;
delay_ms(2);

PORTB=table[min2];
PORTC=0x08;
delay_ms(2);

PORTB=table[hour1];
PORTC=0x10;
delay_ms(2);

PORTB=table[hour2];
PORTC=0x20;
delay_ms(2);



if(flag==1){


            flag=0;
            }
   
 




if(input(A0)==0) 
        {
              disable_interrupts(INT_RTCC);
             if(input(A1)==0){
                             delay_ms(250);
                            if(++min1>9)       {
                                min1=0;
                             
                                           if(++min2>5)  {
                                                min2=0;
                                                         }
                                               }
                                     
                           }
             if(input(A2)==0){
                                            delay_ms(250);
                                             if( ++hour1>9 ){                                                         
                                                         hour1=0;
                                                         ++hour2;
                                                            }
                                               if( (hour2==2) & (hour1>3) )  {
                                                                 sec1=0;
                                                                 sec2=0;
                                                                 min1=0;
                                                                 min2=0;
                                                                 hour1=0;
                                                                 hour2=0;
                                                                             }     
                                                   
                           }
          }
else if(input(A0)==1){
            enable_interrupts(INT_RTCC);
               }
    }
 }



 #int_RTCC
void microII()

{                            //void switch_time();
if(--counter>0)return;
counter=125;
flag=1;


if(++sec1>9){
   sec1=0;
           
   if(++sec2>5){
       sec2=0;
                     
       if(++min1>9){
           min1=0;
                             
            if(++min2>5){
                min2=0;
                                      if( ++hour1>9 )
                                                            {
                                                         hour1=0;
                                                         ++hour2;
                                                            }
                                               if( (hour2==2) & (hour1>3) )  {
                                                                 sec1=0;
                                                                 sec2=0;
                                                                 min1=0;
                                                                 min2=0;
                                                                 hour1=0;
                                                                 hour2=0;
                                                                             }               
                                                                     
                                                                                       
                         }
                     }
                }
           }


 } 





all from here

http://www.youtube.com/watch?v=Qnc5p8SeGeE
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