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

#use timer - error 100

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



Joined: 11 Dec 2010
Posts: 60

View user's profile Send private message

#use timer - error 100
PostPosted: Mon Oct 31, 2011 3:10 am     Reply with quote

Hello.

I'm using a PIC16F88 and want to use the function get_ticks ().
To use this function I need to use the "# use timer," but the compiler gives error.

I'm writing the following code:
Code:
#use TIMER (TIMER=0, TICK=1ms, BITS=8, NISR)


"Error 100 - (...) timebase wrong for this timer"

My version of CCS is the 4.114.


thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 4:05 am     Reply with quote

The error is telling you what is wrong.
Timer0, can't generate something even close to 1mSec tick (with your clock rate).
Last option also needs to be NOISR....
What is your clock rate?.
The #use delay 'clock' statement needs to be in front of this line (you would get an error if you haven't got this first).
What compiler version?.
What watchdog settings have you got? (remember the timer0 prescaler is shared with the watchdog).

Best Wishes
Dave_25152



Joined: 11 Dec 2010
Posts: 60

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 4:58 am     Reply with quote

Code:
#include <16f88.h>
#device adc=10
#use delay(internal=4Mhz)
#fuses INTRC_IO, NOWDT, PUT, NOMCLR, NOBROWNOUT, NOLVP, WRT, CPD
#use TIMER (TIMER=0, TICK=1ms, BITS=8, NOISR)


He still does not work.

Compiler version: 4.114


Thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 6:28 am     Reply with quote

OK.
That's a fault with 4.114 I'm afraid.
It'll complain if it can't do the exact rate. Latter compilers have this fixed. So you need to put a time interval in, that _is_ achievable with this timer, or use a timer that can achieve the rate you want.

#use TIMER (TIMER=0, TICK=1024uS, BITS=8, NOISR)

Best Wishes
Dave_25152



Joined: 11 Dec 2010
Posts: 60

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 6:58 am     Reply with quote

Good
The problem has been found.

As you have done to calculate the 1024uS?


Thank you!
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 8:30 am     Reply with quote

Data sheet of the chip.
Timer is 8bit, divides by 256. Master clock/4, through a prescaler of 1,2,4,8,16,32,64 or 128. So times of:

256, 512, 1024, 2048, 4096, 8192, 16384, or 32768uSec supported.

Best Wishes
Dave_25152



Joined: 11 Dec 2010
Posts: 60

View user's profile Send private message

PostPosted: Mon Oct 31, 2011 8:33 am     Reply with quote

Ahhhhh.

OK. I've got it. Thank you!


Best wishes to you.
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