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

Timer0 not working

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



Joined: 10 Sep 2022
Posts: 20

View user's profile Send private message

Timer0 not working
PostPosted: Wed Nov 02, 2022 11:18 am     Reply with quote

Code:
#include  <16F18855.H>     //includes #device spec
#use delay (INTERNAL=4MHZ)   //Says INTERNAL OSCILLATOR is 4MHz

#Int_Timer0
void Timer0Int () {
   output_toggle(Pin_B2); //led flash
}

main () {
   Setup_Timer_0 (T0_INTERNAL | T0_DIV_8); //
   Set_Timer0(0);
   output_high(Pin_B1);  //led on
   while (1) {   }
}


The fixed led B1 comes on, the flashing led B2 stays off. This is about as simple as I can make it. If I make B2 always on, and B1 toggle, then B2 stays on and B1 never comes on. This is a PPS chip but I see nothing related to that. Losing my hair though that's probably more related to the radiation and chemo.
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Nov 02, 2022 11:33 am     Reply with quote

Maybe I'm having a 'senior's moment' but I'd say you have to ENABLE the interrupt ??
dDelage



Joined: 10 Sep 2022
Posts: 20

View user's profile Send private message

Timer0 not working
PostPosted: Wed Nov 02, 2022 2:12 pm     Reply with quote

Now that's embarrassing! 1K lines of code, adding a feature and forget a simple requirement. Been using PIC chips for 20 years! Too soon old, too late smart.
Thanks,
Dave
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Nov 02, 2022 3:15 pm     Reply with quote

Look on the bright side....it was easy for me to spot ! I remember having 15 minutes to 'mull over' my 'sillies', while waiting for the UV eraser to work magic on the PIC16C84, that was NEW ..once upon a time........
Ttelmah



Joined: 11 Mar 2010
Posts: 19496

View user's profile Send private message

PostPosted: Thu Nov 03, 2022 2:12 am     Reply with quote

A 'duh' moment.
They happen!... Sad
temtronic



Joined: 01 Jul 2010
Posts: 9221
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Nov 03, 2022 6:55 am     Reply with quote

seems the older I get..the MORE they happen Sad
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