sbit LCD_RS at RC1_bit;
sbit LCD_EN at RC0_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISC1_bit;
sbit LCD_EN_Direction at TRISC0_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
char temp[80]={' '};
char uart_rd,h=0;
void gsm();
void main()
{
unsigned int i,t=1;
unsigned char j,x=0,d=0,rec;
main: Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
UART1_Init(9600);
gsm();
Delay_ms(1000);
Lcd_Out(2, 5, "ready");
while(1)
{
if (UART1_Data_Ready()==1)
{
UART_Read_Text(temp, "ok", 80);
Lcd_out(1,1,temp);
}
}
}
void gsm()
{
UART1_Write_Text("AT");
UART1_Write_Text("\r");
Delay_ms(5);
UART1_Write_Text("AT+CMGF=1");
UART1_Write_Text("\r");
Delay_ms(5);
UART1_Write_Text("AT+CNMI=1,2,0,0,0");
UART1_Write_Text("\r");
Delay_ms(5);
}