Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Capacitance stops system clock

Status
Not open for further replies.

upand_at_them

Active Member
I have a weird issue with my 16F88 circuit using the comparator peripheral.

I can get the system clock to stop by putting my finger near the comparator input pins. I can understand this affecting the comparator operation, but why would it affect the system clock?

I have component leads as short as possible and I've got a decoupling cap.
 
Any and all unused CMOS inputs need to be connected to something; ground or VCC. The choice is the one with the lowest power consumption. Just getting close to a non-pulled up or pulled down pin can cause erratic oscillations in any CMOS part.

OP amps may need a bias return path.

I can't speak for the PIC chip. Just, in general it's true.
 
I can't speak for the PIC chip. Just, in general it's true.

It's not for a PIC, they aren't really affected by the flaws of standard CMOS gates.

The most likely cause of his problem is that it's wired or programmed wrong, and that he has left the MCLR (reset) pin floating, so either connect MCLR to Vdd, or disable it in the config fuses.
 
Well, I have all unused pins unconnected and set as outputs and I also have MCLR tied to Vdd via a 10K resistor. The only pins defined as inputs are the two comparator pins and the RX pin. Low Voltage Programming and Brownout Detect are both turned off.

This is the input circuit to the comparator's non-inverting input:
10-07-2011 7-15-39 PM.png

The inverting input is tied to Vss. And the other comparator is turned off (CM2:CM0 = 101).

If I simply disable the comparator by setting CMCON = 0 the problem goes away. But of course my circuit won't work.

Also, I am witnessing the system clock stalling by a blinking LED as well as UART output; both will stall or slow dramatically until I remove my finger.
 
Post your code the configure for the 16f88 is easy to set wrong
 
What are you using to power the PIC?

Is it a "clean" DC supply?

Is the 0v side of the supply grounded, or is it floating at half mains supply due to leakage capacitance in the mains transformer?

Is there adequate decoupling at the PIC supply pins?

JimB
 
Solderless breadboard, 7.37MHz crystal, with 22pF caps. The power supply is a 7805 regulator board plugged into the breadboard, with 0.1uF and 100uF caps. Also, there is a 0.1uF cap near the PIC on the breadboard. Component leads are as short as possible.

I scoped the PIC Vdd pin:
VddPin.PNG
and the PIC Vss pin:
VssPin.PNG

...Yeah, that spike is disconcerting. It occurs at ~ 46kHz.

I read the config bits out of the PIC via the programmer:
WDTE: Disabled
PWRTE: Enabled
FOSC: HS oscillator
MCLRE: MCLR pin is MCLR function
BOREN: Disabled
LVP: Disabled
CPD: Disabled
WRT: Protection Off
DEBUG: Disabled
CCPMX: CCP1 function on RB0
CP: Disabled
FCMEN: Disabled
IESO: Disabled

Anything I should test? I can try running it from a battery.
 
Last edited:
The spike on the Vss pin look bigger than the one on the Vdd pin, where is the scope probe ground lead connected to the circuit?

The power supply is a 7805 regulator board plugged into the breadboard
And what is powering the 7805?

I can try running it from a battery.
Yes, why not.

JimB
 
The Vdd spike is smaller, because the probe ground lead is connected to the same side of the breadboard. If I moved the probe ground to the other side it'd probably make the Vdd spike bigger...I'm assuming. I'm not sure if the spike is an issue, since I can get rid of the clock stalling by turning off the comparator (and the spike still occurs).

The 7805 regulator board is powered by a 12V wall wart.

I ran the circuit from a battery and the spike is much diminished, but the clock stalling issue remains. So now I have to ask...Is this just expected behavior?
 
Have you tried removing the crystal and load capacitors from the breadboard? I've heard people recommend bending the pins upward and soldering or just twisting the leads together tightly, the amount of stray capacitance on a breadboard in addition to that of a human being could easily affect the oscillator at that frequency. The general rule of thumb I've heard is that 10mhz is about the cutoff limit for usefulness of a solderless breadboard and even then you have to take into account the parasitic capacitance. I've heard many times that someone used certain capacitor values on a breadboard and then move the circuit to a perfboard setup and it stops working because the bread boarded circuit was working with the parasitic capacitance of the breadboard. An oscillator stopping because of the additional stray capacitance is also a common theme I've heard over the years.
 
Last edited:
Well, I have all unused pins unconnected and set as outputs and I also have MCLR tied to Vdd via a 10K resistor.

A small capacitor (100nF) from MCLR to ground might help. You may be getting a reset from the spike. See Microchip documents.

John
 
Have you tried removing the crystal and load capacitors from the breadboard?

I can touch the crystal and caps all I want with no affect, it's only when related to the comparator input pin. Also, I built an identical circuit using the internal oscillator (no crystal, no caps) and had the same issue.

A small capacitor (100nF) from MCLR to ground might help. You may be getting a reset from the spike.

Tried it. But the chip isn't resetting, it's simply slowly down.
 
What exactly are you doing with the comparator?

Are you sure it's the clock that slowing down, or is it your code?
 
As be80be said, it's the code.
 
Could you be picking up the power line frequency by touching the comparitor inputs, just like when you touch a scope probe.

If it won;t happen in real life, then

"Don't touch the pin!"

Like the doc says to the patient when the patient says "It hurts when I touch here". Doc says: "Don't touch there then".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top