Page 1 of 1

PWM_OUT strange startup behaviour - PIC16F15214

PostPosted: Sat Mar 08, 2025 5:55 pm
by pushpak_ladake
Hello Friends,
Good Day,


I am trying to generate the PWM out signal of 396 Hz with 70 % Duty Cycle,
the project description with configurations is as below


IDE: MPLAB xI DE
Compiler: XC8
MCC: Melody

MCU: PIC16F15214

HFINTOSC: 1MHz
Peripheral Clock: 1Mhz

TMR2 clock source: FOC/4 (for PWM out RA4)
TMR2 prescaler: 1:4

PWM Frequency: 394 Hz
PWM Duty Cycle: 70 %

i have successfully generated the PWM signal, as shown in the image below,

Blue Signal: Vbat Battery Power Signal
Yellow Signal: PWM Out (RA2)
Startup Delay for PWM Signal(delta X): 45ms

https://photos.app.goo.gl/TK64rJcRvmEMhaq57
Pic.1


But at startup the PWM out signal is showing some strange behavior, as shown below (zoomed in pic 1),
https://photos.app.goo.gl/c5duNcV5k79RjC4a9
Pic. 2


what can be the reasons behind these unwanted signals and How can i remove them.

Re: PWM_OUT strange startup behaviour - PIC16F15214

PostPosted: Mon May 19, 2025 4:09 am
by ric
what can be the reasons behind these unwanted signals and How can i remove them.

Melody is probably setting the pin as an output during startup.
That's one of the hassles of using a code generation engine, you lose complete control over how things are initialised.
There is probably a "pins.c" source file containing the pin initialisation that you could check.