Connect with us

PWM pin on PIC24FJ64G004?

Discussion in 'Microcontrollers, Programming and IoT' started by eem2am, Nov 20, 2012.

Scroll to continue with content
  1. eem2am

    eem2am

    414
    0
    Aug 3, 2009
    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
     
  2. Harald Kapp

    Harald Kapp Moderator Moderator

    10,070
    2,151
    Nov 17, 2011
    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
     
  3. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    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...
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-