Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
mikroC PRO for PIC32
MikroElektronika
359
Library Example
The following code is code for the Manchester receiver, it shows how to use the Manchester Library for receiving data:
Copy Code To Clipboard
// LCD module connections
sbit LCD_RS at LATB2_bit;
sbit LCD_EN at LATB3_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
// Manchester module connections
sbit MANRXPIN at RF0_bit;
sbit MANRXPIN_Direction at TRISF0_bit;
sbit MANTXPIN at LATF1_bit;
sbit MANTXPIN_Direction at TRISF1_bit;
// End Manchester module connections
unsigned int error;
char ErrorCount, chr_counter, byte_rcvd;
void main() {
ErrorCount =
0
;
chr_counter =
0
;
CHECON =
0x32
;
AD1PCFG =
0xFFFF
;
// Configure AN pins as digital I/O
TRISB =
0
;
LATB =
0
;
Lcd_Init();
// Initialize LCD
Lcd_Cmd(_LCD_CLEAR);
// Clear LCD display
Man_Receive_Init();
// Initialize Receiver
while (
1
) {
// Endless loop
Lcd_Cmd(_LCD_FIRST_ROW);
// Move cursor to the 1st row
while (
1
) {
// Wait for the “start” byte
byte_rcvd = Man_Receive(&error);
// Attempt byte receive
if (byte_rcvd ==
0x0B
)
// “Start” byte, see Transmitter example