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

PIC16F88 watchdog & PWM & external pulse count same

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



Joined: 17 Nov 2011
Posts: 187

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

PIC16F88 watchdog & PWM & external pulse count same
PostPosted: Thu Nov 30, 2017 7:21 am     Reply with quote

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.

Smile

best regards
-arto-
Ttelmah



Joined: 11 Mar 2010
Posts: 19513

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 9:44 am     Reply with quote

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

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

PostPosted: Thu Nov 30, 2017 9:57 am     Reply with quote

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 Smile
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

View user's profile Send private message

PostPosted: Thu Nov 30, 2017 11:13 am     Reply with quote

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.
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