User manual

Table Of Contents
354
mikoC PRO for PIC32
MikroElektronika
Manchester Code Library
The mikroC PRO for PIC32 provides a library for handling Manchester coded signals. The 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 0 or 1; the second half
is the true bit value and the rst half is the complement of the true bit value (as shown in the gure below).
Important:
- The Manchester receive routines are blocking calls (Man_Receive_Init and Man_Synchro). This means that
MCU will wait until the task has been performed (e.g. byte is received, synchronization achieved, etc).
- Manchester code library implements time-based activities, so interrupts need to be disabled when using it.
The following variables must be dened
in all projects using Manchester Code
Library:
Description: Example:
extern sfr sbit MANRXPIN;
Receive line.
sbit MANRXPIN at RF0_bit;
extern sfr sbit MANTXPIN;
Transmit line.
sbit MANTXPIN at LATF1_bit;
extern sfr sbit MANRXPIN_
Direction;
Direction of the Receive pin.
sbit MANRXPIN_Direction at TRISF0_
bit;
extern sfr sbit MANTXPIN_
Direction;
Direction of the Transmit pin.
sbit MANTXPIN_Direction at TRISF1_
bit;
External dependencies of Manchester Code Library