View previous topic :: View next topic |
Author |
Message |
SSR
Joined: 09 Nov 2011 Posts: 14
|
18f452 timer0 problem |
Posted: Wed Nov 09, 2011 6:05 am |
|
|
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: 19477
|
|
Posted: Wed Nov 09, 2011 6:26 am |
|
|
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
|
|
Posted: Wed Nov 09, 2011 9:51 am |
|
|
Ok thanks. |
|
|
SSR
Joined: 09 Nov 2011 Posts: 14
|
|
Posted: Wed Nov 09, 2011 10:07 am |
|
|
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? |
|
|
|