This project shows you how to decode Manchester codes using the Logic Analyzer instrument Digilent Digital Discovery.
Digilent Digital DiscoveryDigilent Digital Discovery is a combined logic analyzer, protocol analyzer, and pattern generator instrument that was created to be the ultimate embedded development companion compatible with a wide variety of digital systems. Digital Discovery was designed to optimize channels, speed, and portability. Allows you to debug, visualize, and simulate digital signals for most embedded projects. The instrument uses a 32-channel digital logic analyzer (1.2…3.3V CMOS, 8 channels at 800MS/s*, 16 channels at 400MS/s*, and 32 channels at 200MS/s). WaveForms is a free software application for Digital Discovery and enables the use of the available instruments including Logic Analyzer, Pattern Generator, and Protocol Analyzer.
We also use Multisim Live to simulate the communication. Multisim Live is an online SPICE circuit simulator which gives you the ability, to create, interactively simulate, learn, and share circuit all using a web browser. You have access to numerous virtual versions of benchtop test equipment like an oscilloscope, function generator, spectrum analyzer, network analyzer, and for this project, logic analyzer.
Manchester Encoding
A Manchester code is a self-clocking binary code achieved by encoding every data bit with a transition from high to low, or from low to high. This type of encoding is used mainly in applications where galvanic isolation is needed, or where the number of lines available for communication is limited. There are two accepted standards of Manchester encoding: one in which HIGH values are represented by falling edges of the signal and LOW values by rising edges, and the inverse.
Source: https://en.wikipedia.org/wiki/Manchester_code#/media/File:Manchester_encoding_both_conventions.svg
The main advantage of Manchester encoding is that the resulting signal won't remain at a logic HIGH or LOW level for a longer period of time, so the signal can be AC coupled, which means that the DC component of the signal can be eliminated. AC coupling an unencoded digital signal is simulated in MultsimLive. The ambiguous voltage level (0V) can be observed every time when a longer series of HIGH or LOW bits appear. However, the data rate of Manchester encoding is only half of the bandwidth. In other words, to send one information bit, two logic states have to be sent.
Encode a signal using Manchester encoding scheme
Let's use the Pattern Generator instrument in Digital DiscoveryDigital Discovery. We also create the binary data in Python and save it to a CSV file. This file is imported WaveForms. Here are pseudo codes
Import libraries NumPy, pandas
Define parameters falling edge = 1, least significant bit transferred first =1, number of bits = 8
Input the string that will be converted into binary value
Convert the string into binary values
Double every bit to make the data signal twice slower than the clock
Convert the strings to arrays of integers
Element-wise XOR two arrays to get the Manchester code
Create a data frame
Decode Manchester codes with Logic Analyzer
To decode the Manchester encoded signal, open the Logic Analyzer instrument in WaveForms and add Manchester at adding channels. Set the frequency to half of the frequency of the generated signal. With the help of the respective drop-down lists, set the parameters of the encoding to the same as in the Python code. Start the instrument. Set the time base and the position in a way, to make the message visible.
Get all the project details and the source code for this project on the Digilent Reference Page.