hola tengo problemas a la hora de recibir datos, es una comunicacion con el celular donde apaga un led pero no hay respuesta, alguien puede ayudarme? gracias.
// CONFIG1
#pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT enabled)
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is MCLR)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config CPD = OFF // Data Memory Code Protection (Data memory code protection is disabled)
#pragma config BOREN = ON // Brown-out Reset Enable (Brown-out Reset enabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = ON // Internal/External Switchover (Internal/External Switchover mode is enabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)
// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
#pragma config PLLEN = OFF // PLL Enable (4x PLL enabled)
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled)
#include <xc.h>
void interrupt recepcion ()
{
char x;
x = RCREG;
if (x==49)
{
PORTA=0b00000001;
}
if (x==50)
{
PORTA=0b00000000;
}
PIR1bits.RCIF=0;
}
void main ()
{
OSCCONbits.IRCF=1100; // 2 Mhz cristal interno
OSCCONbits.SCS=10; // Fuente del reloj
TRISA = 0;
PORTA = 0;
TRISB = 0b00000010;
PORTB = 0;
INTCONbits.GIE=1;
INTCONbits.PEIE=1;
PIE1bits.RCIE=1;
PIR1bits.RCIF=0;
RCSTAbits.SPEN=1;
RCSTAbits.CREN=1;
TXSTAbits.SYNC=0;
BAUDCONbits.BRG16=0;
TXSTAbits.BRGH=0;
SPBRG = 51;
while (1)
{
}
}