View previous topic :: View next topic |
Author |
Message |
chemtastic23
Joined: 09 Dec 2010 Posts: 4
|
anybody know what is functions of timer2 interrupt? |
Posted: Thu Dec 09, 2010 2:29 pm |
|
|
I'm new to this C. May I know what is functions of timer2 interrupt? What is the diff between timer1 and timer2 interrupt? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
chemtastic23
Joined: 09 Dec 2010 Posts: 4
|
|
Posted: Thu Dec 09, 2010 2:41 pm |
|
|
is this correct?
Code: |
#include <16f877a.h>
#use delay (clock = 2000000)
#fuses hs,nprotect,nowdt,nolvp
void main ()
{
enable_interrupts(int_timer2);
enable_interrupts(GLOBAL);
|
|
|
|
dbotkin
Joined: 08 Sep 2003 Posts: 197 Location: Omaha NE USA
|
|
Posted: Thu Dec 09, 2010 2:44 pm |
|
|
It's not completely correct... if you don't have case sensitivity disabled, it's INT_TIMER2 and not int_timer2. And fo course that code fragment is incomplete. But you have the general idea, yes.
Did a new semester just start somewhere? |
|
|
chemtastic23
Joined: 09 Dec 2010 Posts: 4
|
|
Posted: Thu Dec 09, 2010 2:50 pm |
|
|
what I'm trying to do is I'm using this PIC16f877a
and I'm using the ccs c compiler
-PIC will continuously toggle LED at PORT RB1, RB2 and RB3 and toggle buzzer ON and OFF in seq every 1 sec. When interrupt occur all LED will automatically turn OFF and only turn ON LED RB4. (interrupt is timer2).
And after 2sec all sequence function back as normal .
My problem is I don't know how to use the timer2 interrupt. Sorry guys. I'm newbie |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 09, 2010 2:55 pm |
|
|
Obviously you're the same person as fariq23 here, because you have
the same exact requirements, LED, Buzzer, 2 seconds:
http://www.ccsinfo.com/forum/viewtopic.php?t=44210
Please don't sign up under multiple names and post the same topic.
Keep one name, and ask for help with that name. |
|
|
chemtastic23
Joined: 09 Dec 2010 Posts: 4
|
|
Posted: Thu Dec 09, 2010 2:56 pm |
|
|
no im not! he is my friends. we are in the same class. we got trouble of this interrupt things. im sorry |
|
|
|