mikroC

making it simple...

Manchester Code Library

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC provides a library for handling Manchester coded signals. Manchester code is a code in which data and clock signals are combined to form a single self- synchronizing data stream; each encoded bit contains a transition at the midpoint of a bit period, the direction of transition determines whether the bit is a 0 or a 1; second half is the true bit value and the first half is the complement of the true bit value (as shown in the figure below).

Manchester RF_Send_Byte format

St1 St2 Ctr B7 B6 B5 B4 B3 B2 B1 B0

Bi-phase coding

1

0

 

 

 

 

2.4ms

 

 

 

 

 

 

 

 

 

Example of transmission

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 1 0 0 0 1 0 0 0 1 1

Notes: Manchester receive routines are blocking calls (Man_Receive_Config, Man_Receive_Init, Man_Receive). This means that PIC will wait until the task is performed (e.g. byte is received, synchronization achieved, etc). Routines for receiving are limited to a baud rate scope from 340 ~ 560 bps.

Library Routines

Man_Receive_Config

Man_Receive_Init

Man_Receive

Man_Send_Config

Man_Send_Init

Man_Send

 

 

page

 

MikroElektronika: Development tools - Books - Compilers

219