View previous topic :: View next topic |
Author |
Message |
dDelage
Joined: 10 Sep 2022 Posts: 20
|
Timer0 not working |
Posted: Wed Nov 02, 2022 11:18 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Wed Nov 02, 2022 11:33 am |
|
|
Maybe I'm having a 'senior's moment' but I'd say you have to ENABLE the interrupt ?? |
|
![](templates/subSilver/images/spacer.gif) |
dDelage
Joined: 10 Sep 2022 Posts: 20
|
Timer0 not working |
Posted: Wed Nov 02, 2022 2:12 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Wed Nov 02, 2022 3:15 pm |
|
|
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........ |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19369
|
|
Posted: Thu Nov 03, 2022 2:12 am |
|
|
A 'duh' moment.
They happen!... ![Sad](images/smiles/icon_sad.gif) |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9174 Location: Greensville,Ontario
|
|
Posted: Thu Nov 03, 2022 6:55 am |
|
|
seems the older I get..the MORE they happen ![Sad](images/smiles/icon_sad.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|