Searching \ for 'Urgent,timer1 interrupts with PCM compiler.' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'Urgent,timer1 interrupts with PCM compiler.'.

Truncated match.
PICList Thread
'Urgent,timer1 interrupts with PCM compiler.'
1998\05\17@191818 by Sylvia Dokua Kwakye

flavicon
face
Hello,
           Sorry for the panicked title but I do help quickly. I am trying
to use timer1 to wake the PIC up from sleep after 1 minute. I am using the
PCM C compiler.The code  compiles fine, but on the PIC, pin b0 never comes
on. (Timer1 has 32KHz external crystal osc.).If you are familiar with PCM's
compiler could you please take a look and help me out.Maybe, a fresh pair
of eyes will see something that I missed. Needless to say, I have been
staring at it for a while and have not been able to figure out the problem.

#include <16C73.H>
#use Delay(Clock=4000000)
#define max_count 4;
byte the_count;

#INT_TIMER1
wake_1(){
           if( -- the_count != 0){
               sleep();
           }
         else{
             output_high(pin_b0)
             the_count = max_count;
   }
}

main(){
       the_count = max_count;
       output_high(pin_b7);
       set_timer1(0);
       setup_timer_1(T1_EXTERNAL | T1_DIV_BY_8);
       enable_interrupts(INT_TIMER1);
       enable_interrupts(GLOBAL);
       while(true);
}

1998\05\17@224216 by Andrew Warren

face
flavicon
face
Sylvia Dokua Kwakye <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> The code  compiles fine, but on the PIC, pin b0 never comes on.
> (Timer1 has 32KHz external crystal osc.).

Sylvia:

I couldn't tell from the code fragment you posted... Are you
enabling the Timer1 Oscillator (bit 3 of T1CON)?

-Andy

=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - Vista, California
=== http://www.geocities.com/SiliconValley/2499 (personal)
=== http://www.netcom.com/~fastfwd (business)

1998\05\18@171308 by Larry Payne

flavicon
face
Sylvia,


Try changing the timer1 setup line to:

       setup_timer_1(T1_INTERNAL | T1_DIV_BY_8);


cheers,

Larry

1998\05\18@180934 by n/a

flavicon
face
Sylvia Dokua Kwakye wrote:
>
> Hello,
>             Sorry for the panicked title but I do help quickly. I am trying
> to use timer1 to wake the PIC up from sleep after 1 minute. I am using the
> PCM C compiler.The code  compiles fine, but on the PIC, pin b0 never comes
> on. (Timer1 has 32KHz external crystal osc.).If you are familiar with PCM's
> compiler could you please take a look and help me out.Maybe, a fresh pair
> of eyes will see something that I missed. Needless to say, I have been
> staring at it for a while and have not been able to figure out the problem.
>
> #include <16C73.H>
> #use Delay(Clock=4000000)
> #define max_count 4;
> byte the_count;
>
> #INT_TIMER1
> wake_1(){
>          if( -- the_count != 0){

Try rewritting this as follows:

       --the_count;
       if(the_count != 0){

Sometimes it is best not to combine too many things on one line. The
only
thing I don't like is the space between the predecrement and the
the_code.

{Quote hidden}

--
Neil Cherry     http://home.att.net/~ncherry    ncherryspamKILLspamworldnet.att.net

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...