Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Which pins of PIC24FJ64GA004 can give PWM output?

Status
Not open for further replies.
T

treez

Guest
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
**broken link removed**
 

you can select the PWM output to be to one of the programmable peripheral pins
see Table 10.3 isection 10.4 of the manual

e.g. setting pin RP25 for PWM output
Code:
      iPPSOutput(OUT_PIN_PPS_RP25, OUT_FN_PPS_OC2);
       OC2CON1=0;
       OC2CON2=0;
       OC2CON2bits.SYNCSEL=0x1F;			// set trigger/sync source is this OCM module
       OC2RS=(int)(1600); 			 		// set PWM period
       OC2R =(int)(1599L*(dutyCycle)/100L); // duty cycle, period - 1 seems to work better
       OC2CON1bits.OCM=7;					// set Center-aligned PWM mode
       OC2CON1bits.OCTSEL=7;	    		// setect System Clock
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top