PIC18F46K22 UART2 Handler issue
Hello, I'm working with a module I should be sending and receiving from, via UART2.
I send the commands and it works fine, the problems comes when I am supposed to receive data from module in the interrupt. I am receiving nothing.
My LED should be blinking everytime I receive any character via UART2 handler. everything I receive via the serial monitor while testing but nothing happens.
here are the the main functions that could affect the problem :
RCONbits.IPEN= 0x01; //Enable priority level on Interrupts
INTCONbits.GIE_GIEH= 0x01; //enable all high priority interrupts
INTCONbits.PEIE_GIEL=0x01; //enable all low priority interrupts
PIE3bits.RC2IE = 0x01; //EUSART2 Receive Interrupt enabling
IPR3bits.RC2IP=0x01; //EUSART2 receive is high priority
BAUDCON2bits.BRG16=0x01; //16-bit baud rate generator is used
TXSTA2bits.BRGH=0x00; //low speed baud rate
SPBRG2=103; SPBRGH2=0; //value to generate 9600 Baud Rate at 16MHz with minimum error
TXSTA2bits.SYNC=0x00; //Asynchronous mode
RCSTA2bits.SPEN= 0x01; // serial port enabled
RCSTA2bits.CREN= 0x01; //Enable continuous receive
TXSTA2bits.TXEN=1; //enable transmit
void interrupt High_Priority(void)
if(PIR3bits.RC2IF==1 && PIE3bits.RC2IE == 0x01)
post edited by CantFindName - 2019/05/19 06:40:22