Decode Manchester
Decode Manchester
lcxg1 lcxg1
lcxg2 lcxg2
lcxq lcxq
lcxg3 lcxg3
lcxg4 lcxg4
lcxg1 lcxg1
S Q lcxq
lcxg2 lcxg2
lcxq
lcxg3 lcxg3
R
lcxg4 lcxg4
lcxg4
lcxg4
S D Q lcxq
lcxg2 D Q lcxq lcxg2
lcxg1
lcxg1 R
R
lcxg3
lcxg3
lcxg4
lcxg2 J Q lcxq
S
lcxg1 lcxg2 D Q lcxq
lcxg4 K
R
lcxg1 LE
R
lcxg3
lcxg3
LCxMODE<2:0>= 110 LCxMODE<2:0>= 111
6
NCOxOUT
20 D To CLC, CWG
NCO1CLK 11 Q
LC1OUT 10 Overflow NxOE
Accumulator
FOSC 01 NCOx Clock Q TRIS Control
0
20
HFINTOSC 00 NxEN
1 NCOx
2
NxCKS<2:0> NxPFM
Overflow S Q
NxPOL
R Q
3
NxPWS<2:0>
Note 1: The increment registers are double-buffered to allow for value changes to be made without first disabling the NCOx
module. They are shown here for reference. The buffers are not user-accessible.
Two key points to note from this bit stream are that the mid-bit transition as a trigger for NCO and use ¾ bit
bit value is present in the first half of each bit time, time to overflow and capture the next bit value
before the mid-bit transition. There is a transition in the (Figure 7). This ¾ bit time allows up to +/- ¼ bit time of
middle of each bit period. This allows us to use the error.
This essentially is our Manchester decoder, where notice that every bit except the first one is decoded.
CLC OR-XOR is clock and D is data. If we use the The issue can be resolved in several ways, which will
rising edge of a clock signal to capture data from D, we be discussed in the Section “Synchronization”.
The timing diagram above (Figure 9) is decoded into • Stage 3 – XOR gate to provide start time for NCO
the following block diagram (Figure 10). There are five • Stage 4 – AND-OR gate to supply clock to NCO,
stages in this diagram: and to ensure that it clocks for full ¾ bit time
• Stage 1 – Incoming Manchester Signal • Stage 5 – NCO to generate ¾ bit time, started in
• Stage 2 – D flip-flop that captures input data when mid-bit transition of previous bit
NCO is triggered
Data Out
Data In S
D Q1
R FOSC
NCO
Clock Out
CLK OUT
PIC16F1509 IMPLEMENTATION These two blocks together are the most important in
the decoder. They create a fixed length pulse for each
The device chosen for this implementation is rising edge coming out of Stage 2. The output of the
PIC16F1509. It has four CLC blocks to implement NCO is fed back into the AND-OR gate, so that when
combinational logic along with NCO to generate the output of Stage 2 goes to zero, the NCO will
specific bit time. The following section covers the continue clocking until it overflows.
implementation of these blocks using the available
When the part is first configured, it will output a single
resources in this device.
¾ bit length pulse. This is needed to put the NCO in its
active-low state. When it is active, the NCO is waiting
Stage 1 – D Flip-Flop (CLC4) on the output pulse width clocks configured in the
This stage latches in the Manchester data on the falling NCOCLK register.* Once a clock source is supplied, it
edge of the clock signal. This output is the recovered will finish its active pulse and start counting again.
data that will be fed into the microcontroller. The data is *Design Tip: By removing the clock source from the
sampled on the clock falling edge, and is stable to be NCO and holding it in its active state, you have
read on the clock rising edge, because the data line essentially created a way to control the duty cycle of
never changes on a rising clock edge. the NCO.
EQUATION 1:
NCO Clock Frequency * Increment Value 16 MHz Internal Clock F osc * Increment Value
- = -------------------------------------------------------------------------------------------------------------------------
F overflow = ----------------------------------------------------------------------------------------------------- -
2 n 2 20
CONCLUSION
A Manchester decoder is implemented using Microchip’s
award winning CLC blocks. In the chosen
implementation, the NCO and three CLC blocks were
used. Serial data and clock can be fed into an SPI
module, UART, or bit-banged to recover data if needed.
The implementation chosen is using very few CPU cycles
for Manchester decoding, leaving it to process other
application tasks. The part can remain in Sleep mode
between bytes to save power.
There are plenty of other applications where CLC blocks
can be used very efficiently. Manchester encoding and
decoding is just one of them. The new enhanced
mid-range 8-bit core on PIC16F1509 features Microchip’s
Extreme Low-Power XLP technology, and is suitable for a
wide range of applications.
• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
• Microchip is willing to work with the customer who is concerned about the integrity of their code.
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
QUALITY MANAGEMENT SYSTEM Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
CERTIFIED BY DNV Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
== ISO/TS 16949 == devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.