User manual
326
mikoBasic PRO for PIC32
MikroElektronika
Manchester Code Library
mikroBasic 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 dened
in all projects using Manchester Code
Library:
Description: Example:
dim MANRXPIN as sbit sfr external
Receive line.
dim MANRXPIN as sbit at RF0_bit
dim MANTXPIN as sbit sfr external
Transmit line.
dim MANTXPIN as sbit at LATF1_bit
dim MANRXPIN_Direction as sbit sfr
external
Direction of the Receive pin.
dim MANRXPIN_Direction as sbit at
TRISF0_bit
dim MANTXPIN_Direction as sbit sfr
external
Direction of the Transmit pin.
dim MANTXPIN_Direction as sbit at
TRISF1_bit
External dependencies of Manchester Code Library