Hola, quisiera realizar una consulta, debido a que tengo un módulo PIC MINI WEB (con una PIC18f25j10) de Olimex y estoy trabajando con el Stack TCP/IP de Microchip en la versión que olimex proven con su webserver incluido. Mi problema es que trato de conectar un lector RFID ID-12 por el puerto serie ( USART) del módulo, pero al correr el programa, éste se queda en un bucle dentro del stack, puesto que pregunto por el Flag del módulo Usart y siempre me marca 1, luego es la causa de que mi rutina se quede pegada en esa parte del programa al final del main(); dentro del while (1), siendo que al salir de mi rutina yo limpio el flag
(RCIF = 0).
Quisiera saber si uds. pudieran ayudarme, puesto que llevo tiempo con éste problema y no he podido avanzar con mi trabajo de tesis, les envío el código por si alguien pudiera ayudarme a solucionar mi duda o darme alguna nueva idea, mi código propio está al final. Le agradezco de antemano
////////////////////////////////////////////////////// programa principal////////////////////////////////////////////
void main(void)
{
static TICK t = 0;
/*
* Initialize any application specific hardware.
*/
InitializeBoard();
/*
* Initialize all stack related components.
* Following steps must be performed for all applications using
* PICmicro TCP/IP Stack.
*/
TickInit();
/*
* Following steps must be performed for all applications using
* PICmicro TCP/IP Stack.
*/
MPFSInit();
/*
* Initialize Stack and application related NV variables.
*/
InitAppConfig();
// Disable DHCP
SetConfig();
/*
* This implementation, initiates Board setup process if RB0
* is detected low on startup.
*/
if ( PORTB_RB0 == 0 )
{
// Olimex
TXSTA = 0;
RCSTA = 0;
TestExt();
#if defined(USE_LCD)
XLCDGoto(1, 0);
XLCDPutROMString(SetupMsg);
#endif
SetConfig();
}
StackInit();
#if defined(STACK_USE_HTTP_SERVER)
HTTPInit();
#endif
#if defined(STACK_USE_FTP_SERVER) && defined(MPFS_USE_EEPROM)
FTPInit();
#endif
#if defined(STACK_USE_DHCP) || defined(STACK_USE_IP_GLEANING)
if ( AppConfig.Flags.bIsDHCPEnabled )
{
#if defined(USE_LCD)
XLCDGoto(1, 0);
XLCDPutROMString(DHCPMsg);
#endif
}
else
{
/*
* Force IP address display update.
*/
myDHCPBindCount = 1;
#if defined(STACK_USE_DHCP)
DHCPDisable();
#endif
}
#endif
/*
* Once all items are initialized, go into infinite loop and let
* stack items execute their tasks.
* If application needs to perform its own task, it should be
* done at the end of while loop.
* Note that this is a "co-operative mult-tasking" mechanism
* where every task performs its tasks (whether all in one shot
* or part of it) and returns so that other tasks can do their
* job.
* If a task needs very long time to do its job, it must broken
* down into smaller pieces so that other tasks can have CPU time.
*///////////////////////// bucle infinito ////////////////////////////////
while(1)
{
/*
* Blink SYSTEM LED every second.
*/
if ( TickGetDiff(TickGet(), t) >= TICK_SECOND/2 )
{
t = TickGet();
//SLA LATD0 ^= 1;
}
/*
* This task performs normal stack task including checking
* for incoming packet, type of packet and calling
* appropriate stack entity to process it.
*/
StackTask();
#if defined(STACK_USE_HTTP_SERVER)
/*
* This is a TCP application. It listens to TCP port 80
* with one or more sockets and responds to remote requests.
*/
HTTPServer();
#endif
#if defined(STACK_USE_FTP_SERVER) && defined(MPFS_USE_EEPROM)
FTPServer();
#endif
/*
* In future, as new TCP/IP applications are written, it
* will be added here as new tasks.
*/
/*
* Add your application speicifc tasks here.
*/
if(PIR1_RCIF==1){ //esta es la lectura del USART, pregunto por el flag y la primera vez cambia el
LATA2 ^= 1; // estado del led que conecté en RA2 pero se queda titilando,
PIR1_RCIF=0; // lo que me hace creer que el flag al entrar de nuevo en la rutina sigue en uno, a
} //pesar de que lo borro al salir, lo que me hace perder el control
//sobre el Led desde el lector RFID. ésto lo comprobé debugeando con PICKIT2.
ProcessIO();
}