Close

A frustrating bug crushed

A project log for 8051 tuner

A 3-octave tone generator using an 8051 MCU

Ken YapKen Yap 12/03/2018 at 22:380 Comments

Tried a preliminary version of my tuner code which handles the buttons and blinks a LED, before getting into the display handling code. Very frustrated that the LED flashed irregularly and seemingly random. What's more some of the other port 1 pins were also going low some of the time when I tested them with the LED line. Tried all sorts of things, inserting delays, checking for volatile variables, looking at the interrupt handler.

Finally after a night's sleep it occured to me to double check the breadboard jumpers between the MCU and the EEPROM. What do you know, I forgot to hook up one of the high address lines, A13. Which meant that the MCU was being presented with 0xFFs for code bytes some of the time. It was probably resetting every now and then.

Now the MCU reliably executes code. I was probably lucky with the first short blink program that the bug didn't surface then. Lesson: double check all your connections according to the schematic. If I had noticed that address pin from the MCU went nowhere I would have avoided all this.

That's another win for MCUs with integrated flash memory, less to wire up and go wrong.

Discussions