PIC Micro Picky About Power Supplies

I have a PIC 16F628-20 micro running code to generate two dial tones.

It seems to be very fussy about how it is powered. Sometimes it starts on batteries, and sometimes not. On my lab supply, it puts out a steady PWM frequency, but with no modulation. Same goes with an LM7805. In all instances the voltage is 5V.

I don't think it is the PIC chip, since it will operate under what it perceives to be "ideal" conditions.

At present, I have only a 104 decoupling cap between the rail pins. That seems to be a general recommendation.

There must be some best practice thing I am overlooking with regard to making this reliable.

Can someone please point me in the right direction?

Robert Wade

Reply to
Robert Wade
Loading thread data ...

Are you sure the voltage off the batteries is 5V? At 20MHz it needs

4.5 to 5.5VDC power.

If that's not it, then something silly like a missing ground or a floating input pin sounds likely.

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward" 
speff@interlog.com             Info for manufacturers: http://www.trexon.com 
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

Meaning: "sometimes it powers up and properly executes the intended code; other times it just sits there like a blob of inert plastic"? (and, reading ahead: and doesn't even output a steady PWM frequency!)

Meaning: "it has obviously executed *some* code -- to set up the PWM -- but not *all* the code -- to modulate the output as intended"

Is this a correct interpretation?

I'm not sure I understand this statement in the context of those preceding... (but, then again, its raining and I'm a bit distracted)

What does the application of power look like? I.e., does it come up and into spec promptly? Or, does it have a slow, unsteady rise time? Perhaps even non-monotonic?

Reply to
Don Y

What kind of batteries? Any regulator between the batteries and the PIC?

Do you have something like 1 to 10 uF (or more) on the "input" side of the LM7805?

Are you running the internal oscillator, an external resonator, or an external crystal? Are all the oscillator configuration bits set to match what you are using? What oscillator frequency are you trying to use?

If you are using an external resonator or crystal, are you using the capacitors specified in the data sheet? Do you have a PC board, or some breadboard setup (which adds capacitance)? Can you swap for another resonator or crystal - even if it's not exactly the frequency you want - just to eliminate it from consideration?

Has this ever worked under some set of conditions?

Matt Roberds

Reply to
mroberds

On a sunny day (Mon, 18 Aug 2014 12:44:10 +1000) it happened Robert Wade wrote in :

Power supply rise time -> reset look into that. Does the 628 have a delayed clock feature? Reset pin floating? Not used? RC value?

Reply to
Jan Panteltje

Robert Wade wrote in news: snipped-for-privacy@4ax.com:

The usual problems are the PIC failing to reset properly on powerup, or floating input pins.

In the configuration you need to enable BOR (BODEN bit) and PWRT (/PWRTEN bit). With BOR enabled, the PIC is held in reset till Vdd is above a nominal 4V then PWRT holds it in reset for a further nominal 72ms. This ensures the power is stable before the PIC starts running.

The /MCLR pin must *NEVER* be left floating. An external 10K pullup is recommended even if it is disabled by the configuration.

If LVP is left enabled, the PIC will reset unpredictably if the PGM pin is floating. PGM should have a pull-down for reliable programming, but with LVP disabled this isnt needed at runtime..

Set *ALL* unused I/Os as outputs and set them low. Don't leave any floating!

--
Ian Malcolm.   London, ENGLAND.  (NEWSGROUP REPLY PREFERRED)  
ianm[at]the[dash]malcolms[dot]freeserve[dot]co[dot]uk  
[at]=@, [dash]=- & [dot]=. *Warning* HTML & >32K emails --> NUL
Reply to
Ian Malcolm

This was the kind of reply I was looking for. I will try these recommendations tomorrow on the bench. Thanks to everyone who responded.

Robert Wade

Reply to
Robert Wade

Sounds like incorrect power on reset to me.

?-)

Reply to
josephkk

If anyone is still watching this thread, I found the problem. The

16F628-20 wil not run off the 5V regulator.

It needs 5.1VDC. This seems out-of-spec, and thus caught me buy surprise.

Isn't electronics fun?

Robert Wade

Reply to
Robert Wade

On a sunny day (Thu, 28 Aug 2014 12:04:21 +1000) it happened Robert Wade wrote in :

datasheet page 105?

Reply to
Jan Panteltje

Jan Panteltje wrote in news:ltm874$nr2$ snipped-for-privacy@news.albasani.net:

DS40300C has nothing relevant on page 105. FIGURE 17-2 (page 128) is more useful.

I suspect your 5V regulator isnt!

Some linear regulators can act as HF power oscillators if improperly decoupled. Often the only clue if you are simply checking the regulator output on a DMM is that the output appears to be a bit lower than expected . . .

Get the actual regulator manufacturer's datasheet and use the capacitors recommended in the simplest application circuit they give, fitting them as close to the regulator pins as possible. Put a small load on the output and scope it to check it isnt oscillating!

--
Ian Malcolm.   London, ENGLAND.  (NEWSGROUP REPLY PREFERRED)  
ianm[at]the[dash]malcolms[dot]freeserve[dot]co[dot]uk  
[at]=@, [dash]=- & [dot]=. *Warning* HTML & >32K emails --> NUL
Reply to
Ian Malcolm

On a sunny day (Wed, 3 Sep 2014 05:11:37 +0000 (UTC)) it happened Ian Malcolm wrote in :

I removed all the silly no_info Microchip numbers, this pdf says: PIC16F627A/628A/648A Data Sheet FLASH-Based 8-Bit CMOS Microcontrollers

that page is about the power up speed and the brownout speed.

By the look of it your PIC *could* have either a wrong brownout level (voltage set in software in CONFIG) possibly combined with a slow power rise on the supply, or either. The picture on page 105 shows hardware solutions for that (reset too).

I would (if you have one) replace the PIC by an other one and see if the problem is the same.

It is exactly for that reason I always buy at least 2 parts, never one. That saves a lot LOT of time.

Reply to
Jan Panteltje

Please ensure that there are no irritating issues associated with re-settable fuses etc., I had a lot of issues with the Raspberry PI MOdel 2 board, and ended up building my own power supply that feeds power to the board via one of the

2 regular USB ports(NOT the micro USB). The board has now stabilized.
Reply to
dakupoto

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.