Author |
Message |
Topic: Question about interrupt enabling |
johnl
Replies: 12
Views: 31226
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2022 7:19 pm Subject: Question about interrupt enabling |
Yep that did it. Adding a clear_interrupt(INT_RA0) did the trick:
Code:
void main()
{
init();
do {
clear_interrupt(INT_RA);
enable ... |
Topic: Question about interrupt enabling |
johnl
Replies: 12
Views: 31226
|
Forum: General CCS C Discussion Posted: Fri Mar 04, 2022 7:05 pm Subject: Question about interrupt enabling |
I think the problem is that the external pin wake-up interrupt does not have a handler and/or the interrupt flag never gets cleared. It works fine to wake the chip up but when the timer0 int is set up ... |
Topic: Question about interrupt enabling |
johnl
Replies: 12
Views: 31226
|
Forum: General CCS C Discussion Posted: Thu Mar 03, 2022 6:49 am Subject: Question about interrupt enabling |
Is there something missing in this handler? It does repeatedly toggle the output as expected.
#int_timer0
T0ISR()
{
output_toggle(PIN_A2);
}
...
setup_tim ... |
Topic: Question about interrupt enabling |
johnl
Replies: 12
Views: 31226
|
Forum: General CCS C Discussion Posted: Wed Mar 02, 2022 9:11 pm Subject: Question about interrupt enabling |
Thanks PCM. That explains it.
I have a loop that takes pin input from timer1, reads eeprom and outputs highs and lows on pins to flash LEDs with delays from delay_ms and delay_us, but if I set u ... |
Topic: Question about interrupt enabling |
johnl
Replies: 12
Views: 31226
|
Forum: General CCS C Discussion Posted: Wed Mar 02, 2022 5:08 pm Subject: Question about interrupt enabling |
I have A0 set up to wake up a 16F18323 which works fine:
enable_interrupts(INT_RA0);
This works without using enable_interrupts(GLOBAL).
But a timer0 overflow interrupt (during non-slee ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Sun Feb 20, 2022 5:22 pm Subject: 16F636 --> 16F18323 code migration |
Got it working. After disabling most of the functions controlled by PMD0:
PMD0 = 0b11111110; // all off except pin change interrupt
Then restoring PMD0 after wakeup from a pin change:
s ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Sat Feb 19, 2022 12:14 pm Subject: 16F636 --> 16F18323 code migration |
one hint...
to reduce power, be sure to disable any peripherals you're not using.
another
be sure output pins are either high or low NOT 'floating'.
The '636 draws sleep current that I can't mea ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Fri Feb 18, 2022 4:35 pm Subject: 16F636 --> 16F18323 code migration |
temtronic, PCM Programmer and Ttelmah:
Thank you all again for taking the time to help with this project... both now and ten years ago!
All is working now after configuring PPS and getting timer ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Thu Feb 17, 2022 6:32 pm Subject: 16F636 --> 16F18323 code migration |
since your original PIC doesn't have 'single pulse ' mode, simply use the timer1 as before.
BTW since that PIC is 'PPS', be 100% sure that's all setup before you cut 'real code'.......
Yes, I d ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Thu Feb 17, 2022 3:03 pm Subject: PIC16F18323 Gate function |
The timer 1 block diagram on page 265 of the '18323 datasheet shows the T1GSPM bit enabling single pulse mode when low, but the text says otherwise:
Timer1 Gate Single-Pulse mode is first enabled ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Wed Feb 16, 2022 4:34 pm Subject: 16F636 --> 16F18323 code migration |
It wakes from int on A0:
do {
dummy=input(BUTTON); //Pin A0
clear_interrupt(INT_RA);
enable_interrupts(INT_RA0);
SENSOR_POWER = 0;
s ... |
Topic: 16F636 --> 16F18323 code migration |
johnl
Replies: 14
Views: 40787
|
Forum: General CCS C Discussion Posted: Wed Feb 16, 2022 2:35 pm Subject: 16F636 --> 16F18323 code migration |
Well it's time to switch chips. The code is from 10 years ago when Ttelmah, PCM programmer and temtronic all helped me. Here's the link if you're curious:
#include <16F636.h>
#include "p ... |
Topic: Programmer opinion request : Solved |
johnl
Replies: 29
Views: 92328
|
Forum: General CCS C Discussion Posted: Wed Feb 16, 2022 10:36 am Subject: Programmer opinion request : Solved |
Better check STOCK !
Yes, already ordered the next one up, the 16F18324. Thanks for looking into it.
Now for the task of migrating code from the PIC16F636, but that will most likely be a new threa ... |
Topic: Programmer opinion request : Solved |
johnl
Replies: 29
Views: 92328
|
Forum: General CCS C Discussion Posted: Tue Feb 15, 2022 8:20 pm Subject: Programmer opinion request : Solved |
The newer 18323 one is almost half the price and ran the code. Ha... but now they'll need a $300 programmer (ICD4)!
They can use the far cheaper Pickit4.
Ahh... didn't know about this one. It l ... |
Topic: Programmer opinion request : Solved |
johnl
Replies: 29
Views: 92328
|
Forum: General CCS C Discussion Posted: Tue Feb 15, 2022 2:39 pm Subject: Programmer opinion request : Solved |
I was using a 16f636, but it got expensive and this project is for educational (as in "cheap") use. The newer 18323 one is almost half the price and ran the code. Ha... but now they'll need ... |
|