PWM_OUT strange startup behaviour - PIC16F15214

Say "hi" here, and any general non PIC related chat.

PWM_OUT strange startup behaviour - PIC16F15214

Postby pushpak_ladake » Sat Mar 08, 2025 5:55 pm

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.
pushpak_ladake
 
Posts: 1
Joined: Sat Mar 08, 2025 3:41 pm
Location: India
PIC experience: Professional 1+ years with MCHP products

Re: PWM_OUT strange startup behaviour - PIC16F15214

Postby ric » Mon May 19, 2025 4:09 am

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.
Latest test project, an LED matrix display made from one reel of addressable LEDs. here
User avatar
ric
Verified identity
 
Posts: 666
Joined: Sat May 24, 2014 2:35 pm
Location: Melbourne, Australia
PIC experience: Professional 5+ years with MCHP products


Return to Introductions and general chat

Who is online

Users browsing this forum: No registered users and 9 guests