Estimados:
Intentando ver por donde puede llegar a venir el problema, hice otro proyecto en el cual, no uso el USART, sino que cargo manualmente un arreglo de 30 y lo recorro para compararlo con un caracter, y estoy teniendo el mismo problema.
Adjunto todo el código para ver si se puede hallar el problema.
fuses.h
// CONFIG1L
#pragma config WDTEN = OFF // Watchdog Timer Enable bit (WDT disabled (control is placed on SWDTEN bit))
#pragma config PLLDIV = 1 // PLL Prescaler Selection bits (No prescale (4 MHz oscillator input drives PLL directly))
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable bit (Reset on stack overflow/underflow enabled)
#pragma config XINST = ON // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode enabled)
// CONFIG1H
#pragma config CPUDIV = OSC1 // CPU System Clock Postscaler (No CPU system clock divide)
#pragma config CP0 = OFF // Code Protection bit (Program memory is not code-protected)
// CONFIG2L
#pragma config FOSC = ECPLL // Oscillator Selection bits (EC Oscillator with PLL, CLKO on RA6, ECPLL used by USB)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)
#pragma config IESO = ON // Two-Speed Start-up (Internal/External Oscillator Switchover) Control bit (Two-Speed Start-up enabled)
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscaler Select bits (1:32768)
// CONFIG3L
// CONFIG3H
#pragma config CCP2MX = DEFAULT // ECCP2 MUX bit (ECCP2/P2A is multiplexed with RC1)
#pragma config MSSPMSK = MSK7 // MSSP Address Masking Mode Select bit (7-Bit Address Masking mode enable)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
//Variables
unsigned char Rxdata[] = {"+INQ:9000:4E:EA6EC7,3E010C,7FFF,+OK"};
unsigned int NewLineIndex[9],i=0,j=0;
test.c
#include <stdio.h>
#include <stdlib.h>
#include <pic18f67j50.h>
#include <xc.h>
#include "fuses.h"
#include "delays.h"
#include <xlcd.h>
#define _XTAL_FREQ 8000000
#define UP PORTDbits.RD0
void DelayFor18TCY(void);
void DelayPORXLCD(void);
void DelayXLCD(void);
int main(int argc, char** argv){
//Oscilator configuration
OSCCONbits.IDLEN = 0;
OSCCONbits.IRCF = 0b111;
OSCCONbits.OSTS = 0;
OSCCONbits.SCS = 0b00;
//Pin configuration
TRISDbits.RD0=1; //Superior
TRISDbits.RD3=1; //Inferior
//LCD Configuration
OpenXLCD(FOUR_BIT & LINES_5X7); // A 4 bit o I/O y a 5x7
while(BusyXLCD()); // Esperamso a que el Lcd este disponible
/* Table of LCD's posittion
* ===============================================
* |00|01|02|03|04|05|06|07|08|09|0A|0B|0C|0D|0E|0F|
* ===============================================
* |40|41|42|42|44|45|46|47|48|49|4A|4B|4C|4D|4E|4F|
* ===============================================
*/ WriteCmdXLCD(0b00000001); // Clear LCD
SetDDRamAddr(0x00); // Address 04
putrsXLCD("USART v4.4");
SetDDRamAddr(0x40); // Address 04
putrsXLCD("RSSIDataBase");
WriteCmdXLCD(0b00000001); // Clear LCD
SetDDRamAddr(0x00);
putrsXLCD("Presione el");
SetDDRamAddr(0x40);
putrsXLCD("superior");
while(1){
if(UP == 1){
while(UP == 1){};
WriteCmdXLCD(0b00000001); // Clear LCD
SetDDRamAddr(0x00);
putrsXLCD("PELOTUDO");
while(i<40){
if(Rxdata[i] == '+'){
NewLineIndex[j]=i;
j++;
}
i++;
}
WriteCmdXLCD(0b00000001); // Clear LCD
SetDDRamAddr(0x00);
putrsXLCD("Comparacion Hech");
}
}
return (EXIT_SUCCESS);
}
// Delays for LCD's driver
void DelayFor18TCY(void)
{
Delay10TCYx(120);
}
void DelayPORXLCD(void)
{
Delay1KTCYx(180);
return;
}
void DelayXLCD(void)
{
Delay1KTCYx(60);
return;
}