Maker Pro
Maker Pro

PWM pin on PIC24FJ64G004?

eem2am

Aug 3, 2009
429
Joined
Aug 3, 2009
Messages
429
Hello,

I realise PIC24FJ64GA004 has PWM capability, (pg 136 of datasheet says so) though do you know which pins can give a PWM output?

I need the PIC to constantly provide a PWM of 1ms high, 99ms low continously.
(this PWM signal keeps a hardware watchdog capacitor discharged....meaning that the PIC hasn't failed...if the PIC fails, then it will not be able to pulse any more, and the capacitor will charge fully and trip a comparator which indicates PIC failure)

PIC24FJ64GA004 DATASHEET
http://ww1.microchip.com/downloads/en/DeviceDoc/39881D.pdf
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,722
Joined
Nov 17, 2011
Messages
13,722
That is not the right methd to triggger a watchdog. If you use HW PWM this unit may still trigger the watchdog while the software has long run into a deadlock and the processor isn't doing anything useful at all. You can save money and leave out the watchdog completely if you use this method.

A watchdog is meant to be triggered by certain checkpoints in the SW to ensure that the processor is regularly passing these checkpoints and is not stopped e.g. by running into an endless loop.

Examples of such checkpoints can be:
- regularly scheduled tasks e.g. for reading a keyboard, scanning inputs etc.
- re-entry of the main program loop
etc.

Harald
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Good point Harald...

Should be pretty simple to implement the basic idea, not using generic 'SW PWM' aka interrupts that very well could cause the same issue Harald has already pointed out... Something like this is probably best hard coded into the main program loop itself, so when/if the loop stops looping so does the watchdog...
 
Top