View previous topic :: View next topic |
Author |
Message |
artohautala
Joined: 17 Nov 2011 Posts: 187
|
PIC16F88 watchdog & PWM & external pulse count same |
Posted: Thu Nov 30, 2017 7:21 am |
|
|
HI,
I like to make system where watchdog is used and one PIC16F88 pin counts
external pulses and at the same time PWM is working ! Is it possible with PIC16F88 or other PIC processor ?
I really don't know how to make things go ...
so I'm very confused. If I use timer0 to count external pulses I can't use watchdog and vice versa.
If I use PWM I can't use timer2 to count external pulses ?
(I have to count pulses from external clock source (2.097152 Mhz) all the time to get 1 second pulses).
I'll be happy for all the answers to advise me.
best regards
-arto- |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Nov 30, 2017 9:44 am |
|
|
It's possible with most PIC's.
It's even possible with the 88, though not with as much flexibility as more modern chips.
The 88 was a very old PIC (came out over 15 years ago...), which had the limitation of sharing the watchdog prescaler with the timer0 prescaler.
You can use timer0 at the same time as the watchdog, but only without a prescaler. Given this is an 8bit timer, if the frequency is anything beyond rather a slow rate, you risk having to spend a lot of time handling timer overflows.
Timer1 though can merrily count an external clock input, which then leaves the prescaler available for the watchdog.
Hence better to use Timer1.
The PWM uses Timer2.
It is rather pointless to use such an old chip. You can get more modern PIC's without the prescaler limitation, with much more RAM, and ROM, for less money. |
|
|
artohautala
Joined: 17 Nov 2011 Posts: 187
|
|
Posted: Thu Nov 30, 2017 9:57 am |
|
|
Ttelmah wrote: | It's possible with most PIC's.
It's even possible with the 88, though not with as much flexibility as more modern chips.
The 88 was a very old PIC (came out over 15 years ago...), which had the limitation of sharing the watchdog prescaler with the timer0 prescaler.
You can use timer0 at the same time as the watchdog, but only without a prescaler. Given this is an 8bit timer, if the frequency is anything beyond rather a slow rate, you risk having to spend a lot of time handling timer overflows.
Timer1 though can merrily count an external clock input, which then leaves the prescaler available for the watchdog.
Hence better to use timer1.
The PWM uses Timer2.
It is rather pointless to use such an old chip. You can get more modern PIC's without the prescaler limitation, with much more RAM, and ROM, for less money. |
Hi Ttelmah,
Thank you for answering me
what PIC processor do you recommend to use instead of PIC16F88 ?
(it just happened that I had a few PIC16F88 in my junk box)
all the best
-arto- |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Thu Nov 30, 2017 11:13 am |
|
|
Do you have just PCM or PCH?
The capabilities of the PIC18's are much better, so if you have the PCH compiler well worth looking at these. Chips like the PIC18F26K22. |
|
|
|