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

TOIF problem

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



Joined: 10 Apr 2006
Posts: 22

View user's profile Send private message

TOIF problem
PostPosted: Sat Apr 22, 2006 1:28 pm     Reply with quote

Hello,
i was using a pic16f914 and had to switch to a pic16f917 because of rom size. I loaded the program and when compiling i am getting an error that TOIF is an undefined identifier. It worked fine with the 914. Any suggestions! I have the same settings for timer 0. Basically i only changed the header file for the pic. Thanks!
Code:


#int_timer0
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);

toif=0;
if(toif==1)
{
toif=0;
count++;
}
Guest








PostPosted: Sat Apr 22, 2006 2:28 pm     Reply with quote

I have looked in both header files for 16f914 and 16f917 and found no occurences for T0IF flag in any of the headers. You must have defined it yourself in the header for 914 but not in 917.

Copy the T0IF define from the header for 914 to 917, or simply write a new one:

#bit T0IF = 0x0B.2

// t0if not toif
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Sat Apr 22, 2006 3:08 pm     Reply with quote

You could also use the timer interrupt. (Of course you might have some reasons why you don't want to use the interrupt.)

Code:

#int_timer0
void isr_timer0()
{
  ++count;
}
janiga



Joined: 10 Apr 2006
Posts: 22

View user's profile Send private message

Thanks!
PostPosted: Sat Apr 22, 2006 3:15 pm     Reply with quote

You are right i did not define the bit on the 917!

Oh well, thanks

Pedro.

PS
yes i know i can use the isr routine.
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