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.

Micro (PIC16F) gets noise afflicted at certain parts of the program

Status
Not open for further replies.
T

treez

Guest
We have a 40w offline led lamp which uses linear regulators.
It can be dimmed by a microcontroller (PIC16F) on board.
I wrote a program which repeatedly dimmed it from 20% to 50% to 100% to 50% to 20% etc etc….and so on…
It spends some 1 second at each diming level.
I did the dimming by sending a square wave from the micro to an RC (filter) circuit which goes into the dimming pin of the led driver.
I just used the __delay(us) command to get the different dimming duty cycles.
It all works fine on the mains, and is fine on most of our AC PSU’s…but we have one Shekonic AC PSU on which the lamp flickers occasionally. However, the flickering does not always happen, and when it does happen, it only happens at those times when the PWM dimming duty cycle changes (eg from say 20% to 50%)

Do you know why this is?
Why does the noise afflict the micro at these specific times only?
I do not program the micro to read any pin.
-But does the micro (for whatever reason) , read its port before it writes to the port? (eg is this RMW thing going on?)
 

Hi,

I don't think it is a hardware or noise problem, i rather thing it's a software problem.

I don't rely on the "busy wait" function.
It's timing depend on interrupt activity.
AND the total PWM timing additionally depends on the whole loop processing time, which is not constant....
It is rather expectable that there is a lot of jitter on a software generated PWM.

That's why there is a PWM hardware inside a PIC. It needs no continous processing power, it has a fixed stable timing.
The programming effort istn't much more (if ever) compared to the software solution.
Just setup the periferal..

There's a lot of documentation, example code and tutorials...

Klaus
 

I just used the __delay(us) command to get the different dimming duty cycles.
It all works fine on the mains, and is fine on most of our AC PSU’s…but we have one Shekonic AC PSU on which the lamp flickers occasionally.
Regardless of how questionable is the use of closed loop delay functions to generate PWM, if such a procedure worked with other PSUs without occurrence of any flickering, it may be that this one in particular is not being able to have a fast response to an abrupt load change, and a test of proof would be the manipulation of a set of intermediate additional external capacitors (ceramic and electrolitic) between output of this PSU and the input of the driver of the LEDs to see if this reduce the incidence of these artifacts. Of course this is just a workaround solution, once this should ideally be made by the loopback control of the PSU itself which is perhaps where the issue lies indeed.
 
  • Like
Reactions: treez

    T

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top