Estoy trabajando con un GPS y un modulo WISMO, y una variable Analoga la idea es medir el consumo de combustible de un vehículo (Variable Análoga) con respecto a la altura (para eso es el GPS) y enviar esa información a un servidor mediante modulo GPRS (WISMOS), todo funciona de maravilla por etapas, pero ya tengo una problema, cuando integro todo, me surge un problema, el GPS genera interrupciones por puerto serial, y el modulo wismo también genera interrupciones por puerto serial, el problema es que no he podido trabajar con interrupciones por software. cuando digo que interrupciones por software me refiero a un puerto diferente al que trae el micro, estoy trabajando en un PIC16F887 en lenguaje C, en el CCS.
Dejo el código de lo que estoy haciendo hasta el momento como son las interrupciones al micro por software. muchas gracias a quien me pueda orientar. http://i10.forosdeelectronica.net/confused.gif
Dejo el código de lo que estoy haciendo hasta el momento como son las interrupciones al micro por software. muchas gracias a quien me pueda orientar. http://i10.forosdeelectronica.net/confused.gif
Código:
#include <16F887.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPROTECT
#fuses INTRC_IO //oscilador intero
#FUSES PUT //Power Up Timer
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#use delay(clock=8000000)
#use rs232(baud=4800,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=GPS) //PUERTO DE HARDWARE
#use rs232(baud=9600,parity=N,xmit=PIN_B1,rcv=PIN_B0,bits=8,stream=WISMO) //PUERTO DE SOFTWARE
#use fast_io(b)
//DEFINICION DE VARIABLES
int1 x=0;
char dato_serial;
#int_EXT
void EXT_isr(void)
{
if(kbhit())
{
x=1; //bandera de interrupciones
dato_serial=getchar();
}
}
void main()
{
set_tris_b(0b11111010);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
setup_oscillator(OSC_8MHZ);
while(true)
{
if((x==1)&&(dato_serial=='O')) //PREGUNTO SI LLEGO LA VOCAL O
{
x=0;
output_toggle(pin_b2);
}
}
}
Última edición por un moderador: