[SOLVED] response from SIM800 AT Command for IMEI

Status
Not open for further replies.

desgin

Full Member level 1
Joined
Apr 7, 2017
Messages
96
Helped
1
Reputation
2
Reaction score
1
Trophy points
8
Visit site
Activity points
813
Hello All

I am using PIC18F46K80
I want to print IMEI number in my LCD.
So i am sending AT command for the same
But not getting correct response on LCD
Response from GSM Modem - Comming correctly but not able to store properly.
Pelase help me out!!
Its very urgent


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
USART2 - Using for GSM
USART1 - Just reading value at Terminal
 
void GSM_UID_Repsonse()
{
       char ch_UID[50];
       char GSN_Response[50];
       uint8_t i = 0;
 
       send_with_enter("AT+GSN");
       
 
        if(UART2_Data_Ready() == 1)
       {
             for(i=0; i<15; i++)
             {
                   GSN_Response[i] = UART2_Read();
             }
 
             ch_UID[0] =  GSN_Response[0];
             ch_UID[1] =  GSN_Response[1];
             ch_UID[2] =  GSN_Response[2];
             ch_UID[3] =  GSN_Response[3];
             ch_UID[4] =  GSN_Response[4];
             ch_UID[5] =  GSN_Response[5];
             ch_UID[6] =  GSN_Response[6];
             ch_UID[7] =  GSN_Response[7];
             ch_UID[8] =  GSN_Response[8];
             ch_UID[9] =  GSN_Response[9];
             ch_UID[10] =  GSN_Response[10];
             ch_UID[11] =  GSN_Response[11];
             ch_UID[12] =  GSN_Response[12];
             ch_UID[13] =  GSN_Response[13];
             ch_UID[14] =  GSN_Response[14];
             ch_UID[15] =  GSN_Response[15];
             ch_UFSTilt_Count[16]='\0';
             //ch_UID = strtok(ch_UID, "\n");
 
             UART1_Write_text(ch_UID);
       }
}



I post my function also, please help me !!

- Thanks a lot in advance
Please help me
 

Response from GSM Modem - Comming correctly but not able to store properly

Hard to guess what is happening instead of what was expected. Anyway, at a glance it is weird that you are appending the terminator character in another array other than at the end of the ch_UID[] variable. The UART1_Write_text() function is supposed to print strings, which are defined as a chain of ASCII characters ending with '\0' (NULL character).
 
Reactions: desgin

    desgin

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…