code. Similarly, the second four bits were externally b0110
but internally read as b1110, pointing to an interface
problem with RB7 and possibly RB6.
Now that I could confirm the PIC was indeed reading
the pins incorrectly, I could look for a physical cause. It
might have been internal or external, but turned out to be
both! Using the ICD3 as a programmer on pins DB[7: 6]
while the pins also interface to other hardware can be
tricky. Since the target was normally only writing to the
LCD, and the LCD inputs are CMOS, two 4.7K resistors
were installed in series with each line DB[7: 6] between
the PIC and LCD. This provided the in-circuit serial
programming (ICSP) isolation needed by the ICD3 (the
external part of the problem.)
The target and d_board necessarily used different
ports for the LCD and keypad. Most PICs have a PORTB
with programmable internal 50K pull-ups. The d_board
used PORTB for the keypad, and turning on the internal
pull-ups made the keypad termination trivial.
However, the target was using PORTB for the LCD
and the pull-ups were still turned on. Figure 6 is the actual
schematic of the target LCD interface. On inspection, you
can see where this error in coding was leading, as the
output pin of the LCD was now in a voltage divider. An
LCD zero output was raised to
or well above the PIC VOL specification. After properly
turning off the weak pull-ups in the target code, all worked
You may think that I should have anticipated this
problem, and maybe I should have. There are many
gotchas that creep into designs as they evolve and these
can wreak havoc on your intuition. The target was not
originally designed to support ICSP, but retrofitting ICSP
was convenient. In the process of adding the resistors to
the printed circuit board (PCB), I neglected to add them to
the schematic drawing!
One can stare at a drawing all day long trying to
reason why a thing doesn’t work the way one’s mental
image says it should. Fortunately, this Manchester probing
method can kick you out of a false assumption and head
you into a new and profitable direction.
Can This Work in Assembly Code?
It sure can, but the code is a bit more cryptic and
requires more tweaking. Code Block 3 is a bit different
from the Manchester C code and encodes MSB first, so
the logic analyzer settings need to be different.
This module was designed to leak out the register
counters in a capacitive touch panel design. Cap-touch
sensors are very timing sensitive, and use multi-tone
oscillators and counter arithmetic to calibrate and
distinguish human interface events.
The cap-sense design used a PIC12F629 eight-pin
device — not the PIC you would expect to have
debugging resources. (There is a debug header for it
though.) Leaking out the register timers during operation
36 March 2018
FIGURE 6. Actual target LCD interface schematic.
5V = 0.45V