Hi all, I am using mikroC pro and the documentation example on how to communicate via USART with a PIC16F690 connected to a 802.15.4 xbee.
The xbee is working great and it receives signals via radio communications.. the problem is the pic is not responding. It cannot even see that data is arrived.
The pic is connected with a pull-up resistor between mclr pin and Vdd (5V), the xbee is at 3.3V so there's a resistive partitor (10k/18k) between pic Tx and xbee Rx pins (to avoid damage xbee module)
Tx of the pic is linked at Rx of the xbee, and Rx of the pic is linked at Tx of the xbee with the partitor.
There's a led on RB6 I use to check whether this code works:
But till now, the led never switched off...
I tried to send all kind of data via xbee... pic cannot see it. Led won't switch off. Baud rate is correct.
Configuration bits for pic:CONFIG :$2007 : 0x03F4
alias INTERNAL RC NO CLOCK + MASTER CLEAR ENABLE EXTERNAL + BOD ENABLED / SBOREN DISABLED
Someone can help please?
The xbee is working great and it receives signals via radio communications.. the problem is the pic is not responding. It cannot even see that data is arrived.
The pic is connected with a pull-up resistor between mclr pin and Vdd (5V), the xbee is at 3.3V so there's a resistive partitor (10k/18k) between pic Tx and xbee Rx pins (to avoid damage xbee module)
Tx of the pic is linked at Rx of the xbee, and Rx of the pic is linked at Tx of the xbee with the partitor.
There's a led on RB6 I use to check whether this code works:
Rich (BB code):
char uart_rd;
void main() {
// Light up RB6, RB5 digital input
TRISB = 0b00100000;
PORTB.F6 = 0;
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
if(PORTB.F6)
PORTB.F6 = 0;
else
PORTB.F6 = 1;
Delay_ms(1000);
}
}
}
But till now, the led never switched off...
I tried to send all kind of data via xbee... pic cannot see it. Led won't switch off. Baud rate is correct.
Configuration bits for pic:CONFIG :$2007 : 0x03F4
alias INTERNAL RC NO CLOCK + MASTER CLEAR ENABLE EXTERNAL + BOD ENABLED / SBOREN DISABLED
Someone can help please?