Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] using lpc2148 to interface with SIM300

Status
Not open for further replies.

hoperain

Newbie level 1
Joined
Oct 28, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
we used the code written below to interface SIM300 with LPC2148. we are able to send text messages using hyperterminal. We are even able to see the processor sending the AT commands in the terminal of Flash magic (we are using keil for simulation and flash magic for flashing the code) WE have 9600 as the baudrate. Though the processpr and the SIM300 work individually well when clubbed together we are unable to receive the text.
Can you suggest where we could be going wrong
*the code ?
*Something woth the hardware which we might have overlooked?
(we connect the gsm module to the processor using female to female rs232 connector)

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#include <LPC21xx.H>
 
char at_command[]="AT\nn", 
                                                       
     mode[]="AT+CMGF=1n",                                 
     msg_test[]="AT+CMGS=?n",                          
     command_phone[]="AT+CMGS=\"12345678\"n",                          
    msg[]="Hellon";     
                             
 
char  out;
char in;
 
void set_uart()
{
PINSEL0= 0X50005;
U0LCR= 0X83;
U0DLL= 97;
U0LCR=0X03;
U0LCR= 0X83;
U0DLL= 97;
U0LCR=0X03;
return;
}
 
void charout()
{
while(!(U0LSR  &  0X020));
U0THR = out;
return;
}
 
void  my_delay()
{
int i;
for(i=0 ; i<10000; i++);
return;
}
 
void main()
 
{
 
int i=0;
set_uart();
 
IODIR1= 0XFF0000;
IOSET1= 0X00000000; 
 
 out=at_command[i++];
 while(!(out=='n'))
           { 
            charout();
            my_delay();
            out=at_command[i++];
            }
 i=0;
  // enter= 0x0d, 0x0a
  out=0x0d;
  charout();
my_delay();
  out=0x0a;
  charout();
my_delay();
 
IOSET1= 0X00FF0000;
// AT+CMGF=1
 
 
 out=mode[i++];
 while(!(out=='n'))
           { 
            charout();
            my_delay();
            out=mode[i++];
            }
 i=0;
 out=0x0d;
  charout();
my_delay();
  out=0x0a;
  charout();
my_delay();
 IOSET1= 0X00000000;
 
 out=msg_test[i++];
 while(!(out=='n'))
           { 
            charout();
            my_delay();
            out=msg_test[i++];
            }
 i=0;
 out=0x0d;
  charout();
my_delay();
  out=0x0a;
  charout();
my_delay();
 
IOSET1= 0X00FF0000;
 out=command_phone[i++];
 while(!(out=='n'))
           { 
            charout();
          my_delay();
            out=command_phone[i++];
            }
 i=0;
 
 out=0x0d;
  charout();
my_delay();
  out=0x0a;
  charout();
my_delay();
   out=msg[i++];
     while(!(out=='n'))
           { 
            charout();
            my_delay();
             out=msg[i++];
            }
    i=0;
out=0x0d;
  charout();
my_delay();
  out=0x0a;
  charout();
my_delay();
        out= 0x1a; // ctrl+z
my_delay();
}

 

Re: using lpc2148 to interface with SIM300

Code:
AT
delay

ATE0
delay

AT+CMGF=1
delay

-----------------------------------------
 puts("AT+CMGS=\"1234567890\"\n\r");
 puts(" message....\n\r");
 putc(0x1a);
 delay
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top