Interrupts
#include <pic.h>
#device adc=8
#use delay (clock=20000000)
#fuses hs,nolvp,nowdt,noprotect,nobrownout
#use rs232(baud=9600, bits=8, xmit=pin_C6, rcv=pin_C7, parity=n, stream=GSM)
#byte porta=5
#byte portb=6
#byte portc=7
#include "flex_lcd.c"
#include <string.h>
int status_ok=0;
int counter_read=0;
char string[70];
int mem1;
//--Interrupt--
#int_RDA
void serial_int()
{
string[counter_read]=getc();
counter_read++;
if(counter_read==69)
counter_read=0;
if (string[--counter_read]=="+" && string[counter_read]=="C" && string[counter_read++]=="M")
{
mem1=counter_read+5;
}
if((string[counter_read]=="O") && (string[counter_read++]=="K"))
{
status_ok=1;
}
}
//--Main Funtion --
void main()
{
lcd_init();
delay_ms(500);
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
lcd_putc("\fat");
fprintf(GSM, "AT\n\r");
if(status_ok==1)
{
status_ok=0;
lcd_putc("\fat+cmgf=1");
fprintf(GSM, "AT+CMGF=1\n\r");
if(status_ok==1)
{
status_ok=0;
lcd_putc("\fcomplete");
}
}
}
Target for tomorrow:
- Interrupts
-Get +CMTI from GSM Modem