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

interrupt with MPLAB

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







interrupt with MPLAB
PostPosted: Sun Feb 01, 2004 1:59 pm     Reply with quote

Hello,

I am using a 16f628. I want an timer0 interrupt every 200 ?s, so i write:

set_timer0(56);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);

I compile my program and when i launch MPLAB and its debugger, the timer0 doesn't increment and so there is no interrupt. Why, please.
Thank you.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Sun Feb 01, 2004 4:26 pm     Reply with quote

You have to use setup_timer_0() to set it up initially. For example setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_2);
fredbor
Guest







interrupt with MPLAB
PostPosted: Sun Feb 01, 2004 4:40 pm     Reply with quote

Haplo wrote:
You have to use setup_timer_0() to set it up initially. For example setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_2);


Sorry,
i use setup_timer_0(RTCC_DIV_1);
but it doesn't work.

My code for the timer0 is:

setup_timer_0(RTCC_DIV_1);
set_timer0(56);
enable_interrupts(INT_TIMER0);
enable_interrupts(GLOBAL);

It doesn't work in MPLAB and in my project. Why??

Thank you
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Mon Feb 02, 2004 6:52 am     Reply with quote

Post a small test program that shows your problem. You might not have the interrupt coded right but we can't tell without seeing the code.
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