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

18f452 timer0 problem

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



Joined: 09 Nov 2011
Posts: 14

View user's profile Send private message AIM Address

18f452 timer0 problem
PostPosted: Wed Nov 09, 2011 6:05 am     Reply with quote

I am working with the basic of timer and interrupts. The problem is that the code works fine with timer0 of 8 bit. But as i change it to 16 bit it returns error.

#include <18f452.h>
#use delay(clock=1M)
unsigned long a,b,c;
#int_timer0
void isrtimer0(void)
{
for(b=0;b<1000;b++)
{
c++;
}
a++;
if (a==10)
output_A(0xff);
if (a==50)
output_high(pin_c1);
if (a==100)
output_high(pin_c2);
}

void main(void)
{
enable_interrupts(int_timer0);
enable_interrupts(GLOBAL);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256|RTCC_16_BIT);
set_timer0(0);


while(TRUE);

}


The error is "Undefined identifier RTCC_16_BIT".
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Wed Nov 09, 2011 6:26 am     Reply with quote

Because there is no 'RTCC_16_bit' identifier.
Look in the include file for the processor, to see what values are allowed.

16bit, is the _default_, and is what you get if you don't put anything at all. RTCC_8_bit, turns the counter _down_ to 8bit.

Best Wishes
SSR



Joined: 09 Nov 2011
Posts: 14

View user's profile Send private message AIM Address

PostPosted: Wed Nov 09, 2011 9:51 am     Reply with quote

Ok thanks.
SSR



Joined: 09 Nov 2011
Posts: 14

View user's profile Send private message AIM Address

PostPosted: Wed Nov 09, 2011 10:07 am     Reply with quote

one more question.

I have 2 pot connected to AN0 and AN1. I want to read the values of both and then transmit it. on the receiving end i want to perform Task A if AN0 is changed, and Task B if AN1 is changed.

How can i deal with both the channels separately. Any suggestions?
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