Sending message from GSM to txtweb service

Status
Not open for further replies.

shreesha

Newbie level 1
Joined
May 2, 2014
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
0
Activity points
15
i am trying to send message from gsm to txtweb service special number 51115. here is my code

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "prototype.h"
/************************* GSM INITIALIZATION **********************************/
void gsm_ini()
{
    uart_string("AT");
    uart_tx(0x0D);
    uart_tx(0x0A);  
    RI = 0;
    while(uart_rx() != 'K');
    
    uart_string("ATE0");
    uart_tx(0x0D); 
    uart_tx(0x0A);
    while(uart_rx() != 'K');
 
    uart_string("AT+CNMI=2,2,0,0,0");
    uart_tx(0x0D); 
    uart_tx(0x0A);  
    while(uart_rx() != 'K');
 
    uart_string("AT+CMGF=1");
    uart_tx(0x0D); 
    uart_tx(0x0A);
    while(uart_rx() != 'K');
}
 
/******************************* GSM SENDING ***********************************/
void gsm_send(unsigned char *num)
{   
    uart_string("at+cmgs=\"");
    uart_string( num );
    uart_tx('"');
 
    uart_tx(0x0D); 
    uart_tx(0x0A); 
    
    while(uart_rx() != '>');
 
 
    func();
    lcd_cmd(0x01);
    lcd_string("Sending....");
        uart_tx(0x1A);
 
    while(uart_rx() != 'K');
 
    lcd_cmd(0x01);
    lcd_cmd(0x80);
}
/************************** message function  ****************************/
void func()
{
    int g;
    uart_string("HELP ME!!!!!!");
    uart_tx(0x0D); 
    uart_tx(0x0A);
    
        uart_string("lattitude:");
        for(g=18;g<29;g++)
        uart_tx(b[g]);
    
    uart_tx(0x0D); 
    uart_tx(0x0A);
    
        uart_string("longitude:");
            for(g=30;g<42;g++)
            uart_tx(b[g]);
}



but it is failing to send the message.somebody who used txtweb service before please help me.thank you
 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…