TX
- CODE: SELECT_ALL_CODE
#include <htc.h>
#include "usart.h"
#include "delay.h"
__CONFIG(0x3F72);
unsigned char Data = 0;
void main()
{
TRISB = 0x01;
PORTB = 0x00;
init_comms();
Data = 0b10101010;
while(1)
{
if(RB0 == 1)
{
putch(Data);
RB1 = 1;
DelayMs(200);
}
}
}
RX
- CODE: SELECT_ALL_CODE
#include <htc.h>
#include "usart.h"
#include "delay.h"
__CONFIG(0x3F72);
unsigned char Data = 0;
void main()
{
TRISB = 0x00;
PORTB = 0x00;
init_comms();
while(1)
{
Data = getch();
DelayMs(200);
if(Data == 0b10101010)
{
RB0 = 1;
}
}
}