Soumyajit
Junior Member level 3
- Joined
- Feb 8, 2012
- Messages
- 29
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,283
- Location
- Bangalore, India
- Activity points
- 1,448
Hello All,
I have configured the UART on PIC16F690 for data reception as well as transmission, the tx is working fine and data is perfectly received on the computer terminal through COM port. But when I send data to the MCU from the computer, the data isn't coming up. I confirmed using an oscilloscope that the data is actually coming to the MCU RX pin but the RCIF flag is NOT set in the program while the MCU is running. I am using 8 Mhz internal oscillator of the MCU. I am configuring the peripheral this way as shown below:
void init_peripherals(void)
{
TRISB5 = 1; // RX Pin
TRISB7 = 0; // TX Pin
SPBRG = 1666 % 256; // 1200 BPS
SPBRGH = 1666 / 256;
//BAUDCTL
ABDOVF = 0;//Auto Baud overflow Status
RCIDL = 0;//Receiver Idle status bit
SCKP = 0;//Transmitt inverted/non-inverted data
BRG16 = 1;//16-bit baud rate generator enable
WUE = 0;//Wake Up enable
ABDEN = 0;//Auto Baud Detect Enable
//TXSTA
CSRC = 0;//clock source select in synchronous mode
TX9 = 0;//9bit or 8bit transmission selection
TXEN = 1;//transmission enable
SYNC = 0;//synchronous or asynchronous mode
SENDB = 0;//send break
BRGH = 1;//high baud rate selection
TRMT = 1;//transmitt shift register status
TX9D = 0;//ninth bit of tx data
//RCSTA
RX9 = 0;//9th bit receive enable
SREN = 0;//single receive enable in synchronous mode
//CREN = 1;//continuous receive enable
ADDEN = 0;//address detect enable
FERR = 0;//framing error status
OERR = 0;//overrun error status
RX9D = 0;//rth bit of receive data
SPEN = 1;//UART enable
RCIE = 1;
PEIE = 1;
GIE = 1;
CREN = 1;//continuous receive enable
T1CON = 0x001; // Enable Timer 1
TMR1IE = 1; // Enable Timer1 Interrupt
}
Can anyone suggest me what is going wrong?
I have configured the UART on PIC16F690 for data reception as well as transmission, the tx is working fine and data is perfectly received on the computer terminal through COM port. But when I send data to the MCU from the computer, the data isn't coming up. I confirmed using an oscilloscope that the data is actually coming to the MCU RX pin but the RCIF flag is NOT set in the program while the MCU is running. I am using 8 Mhz internal oscillator of the MCU. I am configuring the peripheral this way as shown below:
void init_peripherals(void)
{
TRISB5 = 1; // RX Pin
TRISB7 = 0; // TX Pin
SPBRG = 1666 % 256; // 1200 BPS
SPBRGH = 1666 / 256;
//BAUDCTL
ABDOVF = 0;//Auto Baud overflow Status
RCIDL = 0;//Receiver Idle status bit
SCKP = 0;//Transmitt inverted/non-inverted data
BRG16 = 1;//16-bit baud rate generator enable
WUE = 0;//Wake Up enable
ABDEN = 0;//Auto Baud Detect Enable
//TXSTA
CSRC = 0;//clock source select in synchronous mode
TX9 = 0;//9bit or 8bit transmission selection
TXEN = 1;//transmission enable
SYNC = 0;//synchronous or asynchronous mode
SENDB = 0;//send break
BRGH = 1;//high baud rate selection
TRMT = 1;//transmitt shift register status
TX9D = 0;//ninth bit of tx data
//RCSTA
RX9 = 0;//9th bit receive enable
SREN = 0;//single receive enable in synchronous mode
//CREN = 1;//continuous receive enable
ADDEN = 0;//address detect enable
FERR = 0;//framing error status
OERR = 0;//overrun error status
RX9D = 0;//rth bit of receive data
SPEN = 1;//UART enable
RCIE = 1;
PEIE = 1;
GIE = 1;
CREN = 1;//continuous receive enable
T1CON = 0x001; // Enable Timer 1
TMR1IE = 1; // Enable Timer1 Interrupt
}
Can anyone suggest me what is going wrong?