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

anybody know what is functions of timer2 interrupt?

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



Joined: 09 Dec 2010
Posts: 4

View user's profile Send private message Send e-mail

anybody know what is functions of timer2 interrupt?
PostPosted: Thu Dec 09, 2010 2:29 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 2:33 pm     Reply with quote

This forum is not really about teaching basic PICs or basic C language.
You should use Google to search for Tutorial websites on these topics.
Here are a few tutorial pages that you can read to learn about PICs:

Timer2 tutorial:
http://www.microcontrollerboard.com/pic-timer2-tutorial.html

Newguy's timer tutorial:
http://www.ccsinfo.com/forum/viewtopic.php?t=22467

Microchip -- Timers Tutorial
http://ww1.microchip.com/downloads/en/DeviceDoc/51682A.pdf

Microchip -- Timers: Timer0 Tutorial (Part 2)
http://ww1.microchip.com/downloads/en/DeviceDoc/51702A.pdf
chemtastic23



Joined: 09 Dec 2010
Posts: 4

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 09, 2010 2:41 pm     Reply with quote

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

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

PostPosted: Thu Dec 09, 2010 2:44 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 09, 2010 2:50 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 2:55 pm     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Dec 09, 2010 2:56 pm     Reply with quote

no im not! he is my friends. we are in the same class. we got trouble of this interrupt things. im sorry
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