gsm with PIC controller

Home Forums Microcontrollers PIC Microcontroller gsm with PIC controller

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13903
    ykn
    Participant

    hi all /

    i have written code facing GSM with PIC controller . the code i written in Mikro c pro. i get the serial output but

    could not retrieve the specific data which i want to display on lcd

    please go through the code and correct where i am wrong

    [code]

    #define TRUE 1

    #define bool_val_1 flags. f0
    #define LCD_DIR   TRISD
    #define CTRL_DIR   TRISB
    #define LCD       PORTD
    #define RS        PORTB.F0
    #define E         PORTB.F1
    /////////////////////////////////////////////////////
    #include”lcd.h”

    int flag=0,gps_flag=1;
    int i=0;
    int k;
    char send_data();
    char response[70]=””;

    void main()
    {    CTRL_DIR=0X00;
    LCD_DIR=0X00;
    UART1_Init(2400);              // Initialize UART module at 9600 bps
    Delay_ms(1000);
    /*Soft_UART_Init(&PORTD, 0, 1, 9600, 0);
    delay_ms(500);*/
    init_lcd() ;
    delay_ms(500);
    UART1_Write_Text(“ATE0\r\n”);
    delay_ms(500);
    UART1_Write_Text(“AT\r\n”);
    delay_ms(500);

    while(gps_flag)
    {
    if(gps_flag)
    {
    send_data();
    }
    for(k=0;k++;k<70)
    {
    response[k]=”\0″;
    }
    }

    }
    char send_data()
    {
    char flags;
    char byte;
    int k;
    char num[10];
    bool_val_1 = TRUE;

    UART1_Write_Text(“AT+CPBR=3\r\n”);
    delay_ms(250);
    //cmd_lcd(0x80);
    //string_lcd(“AT+CGPSOUT=32”)  ;
    if(UART1_Data_Ready()>0)
    {
    byte=UART1_Read();
    response[i]=byte;
    delay_ms(1000);
    //string_lcd(response[i]);
    ++i;

    }
    delay_ms(1000);
    if(bool_val_1)
    {
    //UART1_Write_Text(response)  ;
    cmd_lcd (0x01);                         // lcd clear command
    delay_ms(5);
    string_lcd(response);
    delay_ms(1000);
    //Soft_UART_Write(response);
    for(K=4;k++;k>17)
    {
    num[k-4]=response[k] ;
    }
    }
    i=0;
    return ;
    }

    /[code]

    #13904
    ykn
    Participant
    #define TRUE 1
    
    #define bool_val_1 flags. f0
    #define LCD_DIR   TRISD
    #define CTRL_DIR   TRISB
    #define LCD       PORTD
    #define RS        PORTB.F0
    #define E         PORTB.F1
    /////////////////////////////////////////////////////
    #include"lcd.h"
    
    int flag=0,gps_flag=1;
     int i=0;
     int k;
      char send_data();
      char response[70]="";
    
    void main()
     {    CTRL_DIR=0X00;
         LCD_DIR=0X00;
         UART1_Init(2400);              // Initialize UART module at 9600 bps
         Delay_ms(1000);
         /*Soft_UART_Init(&PORTD, 0, 1, 9600, 0);
         delay_ms(500);*/
         init_lcd() ;
         delay_ms(500);
         UART1_Write_Text("ATE0\r\n");
           delay_ms(500);
           UART1_Write_Text("AT\r\n");
           delay_ms(500);
    
         while(gps_flag)
                        {
                          if(gps_flag)
                          {
                            send_data();
                          }
                              for(k=0;k++;k<70)
                              {
                              response[k]="\0";
                              }
                        }
    
    }
     char send_data()
     {
          char flags;
           char byte;
           int k;
           char num[10];
           bool_val_1 = TRUE;
    
           UART1_Write_Text("AT+CPBR=3\r\n");
           delay_ms(250);
           cmd_lcd(0x80);
           string_lcd("AT+CPBR=3")  ;
           while(UART1_Data_Ready()>0)
                                    {
                                    byte=UART1_Read();
                                    response[i]=byte;
                                    delay_ms(1000);
                                    //string_lcd(response[i]);
                                    ++i;
    
                                    }
             delay_ms(1000);
             if(bool_val_1)
             {
              //UART1_Write_Text(response)  ;
              cmd_lcd (0x01);                         // lcd clear command
              delay_ms(5);
              string_lcd(response);
              delay_ms(1000);
              //Soft_UART_Write(response);
              for(K=4;k++;k>17)
              {
               num[k-4]=response[k] ;
              }
             }
    
            //return ;
     }
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
>