Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Which pins of PIC24FJ64GA004 can give PWM output?

Status
Not open for further replies.

treez

Advanced Member level 5
Joined
Sep 22, 2008
Messages
7,602
Helped
561
Reputation
1,125
Reaction score
538
Trophy points
1,393
Location
cambridge
Activity points
76,160
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
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
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

    treez

    points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top