I made simple code for the microcontroller that prints a simple message on the LCD once the microcontroller starts. I arranged my board so that the pull-up resistors and reset resistor (100K) and capacitor (0.1uF) goes inside the DIP socket and I included a 0.1uF decoupling capacitor there as well.

Due to the PCB design, I added jumper wires with ferrite beads on them from regulated +5VDC to the micro's VCC.

I also went crazy with capacitors. I used one 470uF decoupling electrolytic capacitor as the main power reservoir and near that I added a 0.047uF capacitor.

I made the power planes as large as possible and labelled them on the board as + and -.

The crystal is 20Mhz with 33pF pull-down capacitors.

Everytime I attempt to start the microcontroller normally, no code is executed (I get indeterminite output), and the LCD is never initialized.

However, everytime I temporarily add a 22uF capacitor and hold it to the power planes under the microcontroller while powering up the circuit, the code gets executed and the correct message is on the display. So then I soldered the 22uF capacitor in the same spot, tried powering everything normally, and I get nothing.

Is there something my fingers are doing to make the circuit work? (static or something?) This really baffles me.

And would my problem be eliminated if I cut the crystal speed in half?


  • \$\begingroup\$ Try a different power supply. Try something drastically smaller than the 470 uF. Try having your fingers near it but not with the added capacitor, especially try in the vicinity of the crystal circuit. Do you have any external signals connected, especially before power? What happens if you cycle the reset line after power is applied? Inspect the whole board under magnification for solder issues. Can you try just the MCU and crystal and loading caps circuit in a breadboard? Have you left any pins open which should be supplies or have deterministic voltages? \$\endgroup\$ – Chris Stratton Oct 7 '18 at 0:17
  • \$\begingroup\$ The power supply I'll ultimately use is 5VDC fed through an LM2940 regulator (powered with 7.2V battery). Just how much smaller of a cap? I tested it with the external signals in complete idle state to make it not an influence. I tried reset line under normal operation and that didn't help. I also did inspect it under bright light and found no issues with solder. And yes I tried just MCU, crystal and loading caps but not on a breadboard. And no I didn't leave any open pins except for ALE and PSEN on the microcontroller. \$\endgroup\$ – Mike Oct 7 '18 at 0:35
  • \$\begingroup\$ Your reset time constant seems to be 10 times too small (typical values are 10uF and 10k). If the oscillator hasn't reached full amplitude before the reset pulse ends the MCU may not initialize properly. The 22uF cap may not be making a good connection when held by hand, causing glitches on the power rail that might reset the MCU after the oscillator has stabilized. Or perhaps the crystal is weak and needs a glitch to start up. \$\endgroup\$ – Bruce Abbott Oct 7 '18 at 3:14
  • \$\begingroup\$ Do you have enough delays in your read/write cycles? LCD's are painfully slow compared to even a 20MHZ MPU. I think your actions are creating gaps in write cycles allowing the LCD to work. \$\endgroup\$ – Sparky256 Oct 7 '18 at 4:52
  • \$\begingroup\$ How do I know if its officially weak? I mean when I had the circuit running on 5V I measured the crystal connections with the voltmeter and it reports about 2.5V which seems OK. I mean I could replace the crystal but would that make a difference? \$\endgroup\$ – Mike Oct 7 '18 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.