User manual
mikroC PRO for dsPIC
MikroElektronika
405
Manchester Code Library
The mikroC PRO for dsPIC30/33 and PIC24 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 dened 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;
Keypad_Key_Click