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

do can change code as clock ?

 
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

do can change code as clock ?
PostPosted: Sat Sep 24, 2011 9:33 am     Reply with quote

this code normal will count 1- 9999 but me wanna change as clock

Code:
#include <16F877A.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
unsigned char DisBuff[5];
unsigned char Scan_Column[]={0xfe,0xfd,0xfb,0xf7,0xff};
unsigned char SegMent_Code[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};

void Decimal_To_7_SegMent(unsigned int16 Num);
void Scan_Display(void);

void main(void)
{
unsigned int16 Number=0000;
set_tris_b(0x00);
set_tris_d(0x00);
while(true)
{
Decimal_To_7_SegMent(Number);
Scan_Display();
Number++;
}
}

 void Decimal_To_7_SegMent(unsigned int16 Num)
 {

  unsigned int16 temp;
  DisBuff[0]=SegMent_Code[Num/1000];
  temp=Num%1000;
  DisBuff[1]=SegMent_Code[temp/100];
  temp=Num%100;
  DisBuff[2]=SegMent_Code[temp/10];
  temp=Num%10;
  DisBuff[3]=SegMent_Code[temp];
 }
 void Scan_Display(void)
 {
  int i,j;
  for(i=0;i<5;i++)
  for(j=0;j<4;j++)
  {
   output_b(DisBuff[j]);
   output_d(Scan_Column[j]);
   delay_us(1000);
    output_b(DisBuff[4]);
   output_d(Scan_Column[4]);
   delay_us(1000);
  }
 }



temtronic



Joined: 01 Jul 2010
Posts: 9161
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Sep 24, 2011 10:32 am     Reply with quote

What type of 'clock' ?
That doesn't tell anyone what you want to do.

You could 'clock' pulses,'real time',speed of passing cars,etc.
You'll need to define the parameters of your 'clock'.

The better the description of what you want, the better the responses you'll get from this forum.

Also be aware that Proteus/ISIS is FULL of bugs, errors, and invalid DRCs so if and that's a BIG if, code 'works' in simulation there is a HUGE chance it'll never work in the real world.I strongly suggest you get real parts and get some true hands on experience.
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