pocket sized analyzers in the marketplace
now, and they can be acquired for ~$100
and up including the interface software.
I have several Saleae logic units that
work very well, like the eight-bit version in
Figure 1. Being basic, they are not isolated,
and the ground is referenced to the
computer. Use a heavy dose of caution
before you combine these with anything
involving AC or high voltage. You have
The computer side software is very
well done and quite flexible. The best
feature of these units is that — in addition
to the logic display — they are packed with
two dozen protocol analyzers that interpret
the data and overlay it on the logic display.
You can select analyzers that aggregate pin
traces for parallel / I2C / SPI / JTAG / DMX
protocols and many others if that is what
you’re working with.
We want to keep it simple and use a
one-bit protocol. Enter the Manchester
(a.k.a., phase code) code. Originally used more than 60
years ago as a self-clocking code on drum memory
storage systems, it is still used today in places like Ethernet
and RFID. It has some good features such as no DC
component and self-clocking, and some bad features like
inefficient coding, but we don’t really care about any of
The Manchester code is a perfect choice for this
project as the decoder is already implemented in the logic
analyzer (hard) and the encoder is trivial to embed in your
code. It’s a one-bit serial protocol extensible to any length.
Transitions for 1 and 0 are created at the mid-point of a bit
cell, and if needed, at a bit cell boundary.
Figure 2 graphically shows the serial data encoding
process, compliments of Wikipedia.
Figure 3 shows the Options menu for the Saleae
Manchester decoder. Every parameter is easily configured,
including bit time, 1/0 transition direction, word size,
mark/space levels, etc. You simply pick the trace, set the
bit rate, direction, size, and you are done.
The Encoder Code
Code Block 1 is a C function call that receives a byte
of data and a parameter indicating the number of bits to
send. Again, it’s written in Hi-Tech C, but easily adapted to
other compilers. The operation is easy to follow as the
function simply marks to a 1 (to help the decoder), then
formats a bit-cell based on the LSB of the test byte, which
is then right-shifted in the for loop. Another mark to 1
ends the transmission. The comments within Code Block 1
provide further explanation.
March 2018 33
FIGURE 1. PICDem 2P DevBoard with ICD3 and Saleae Logic 8
FIGURE 2. Manchester bit encoding.
FIGURE 3. Saleae Manchester decoder options.
Post comments on this article and find any associated files and/or downloads at