my project is for mplabx , file is bootloader
and my app use 485 code with C(piece code)
for Receive
Send
and my app use 485 code with C(piece code)
Code:
#define RE LATA1
#define DE LATC5
Code:
void ur_init(void) {
INTCON = 0b00000000; //GIE and PEIE disable;TO and INT enable;IntFlag cleared
SPBRG = 25; // 19200 8M HIGH 25
BRGH = 1;
RCSTA = 0x90;
// RCSTA: SPEN RX9 SREN CREN ADDEN FERR OERR RX9D
// 1 0 0 1 0 0 0 0
TXSTA = 0x06;
// TXSTA : CSRC TX9 TXEN SYNC -- BRGH TRMT TX9D
// 0 0 0 0 1 1 0
rclenth = 0;
txlenth = 0;
TRISC7 = 1;
RE = 1;
DE = 0;
CREN = 1;
RCIE = 1;
INTCON = 0b11000000;
}
Send
Code:
DE = 1;
RE = 0;
TXEN = 1;
TXIE = 1;