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.

[51] GSM module"SIM 300" interfacing with 8051 in C language

Status
Not open for further replies.

asoni14593

Newbie level 3
Joined
Mar 15, 2014
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
31
Hi,
I am making a project related to GSM module in which i just want to send message but the error i am facing is how i connect that modem to microcontroller and how i get the output of GSM module on LCD 1602.
i.e. Firstly When i send AT command to the GSM modem how i get OK on my LCD .
Waiting for the Best Reply.
Thank you :)
 

As SIM300 works with UART protocol, use UART TX to send commands.Then what ever GSM replies read with UART RX and display the same on LCD.
smaple code:
Code:
tx_string("AT");
x=RX();
LCD_dat(x);
 
Last edited by a moderator:
Hi,
Sir here it is my whole code.
i did as per ur advise.

firstly it gives an error that
"MAIN.C(38): error C214: illegal pointer conversion"


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
#include<reg51.h>
#include<string.h>
sfr LCD=0xA0; //LCD on Port 2
sbit RS=P0^4;
sbit EN=P0^5;
sbit RW=P0^6;
int i;
void delay(int msec);
void LCD_CMD(unsigned char cmd);
void LCD_alpha(unsigned char alpha);
void LCD_string(unsigned char *string);
void LCD_init();
void Ser_init();
void Ser_TX(unsigned char *msg);
void alpha_sent(unsigned char alph);
 
void main()
{
LCD_init();  
Ser_init();
LCD_string("Serial Port Initialisation DONE!!");
IE=0x92;
Ser_TX("AT");
delay(10);
LCD_alpha(0x0D);   //For Carrier return
delay(50);
}
 
 
void Ser_RX() interrupt 4    //receive msg from GSM module
{
unsigned char rec_msg;
int l_msg;
while(1)
{
while(RI==0);
rec_msg=SBUF; 
l_msg=strlen(rec_msg);      //error generate here
for(i=0;i<l_msg;i++)
{
alpha_sent(rec_msg[i]);
delay(50);
}
RI=0;
}
}
 
void alpha_sent(unsigned char alph) //Send an alphabet to GSM module
{
SBUF=alph;
while(TI==0);
TI=0;
}
 
void Ser_TX(unsigned char *msg) //Send String to GSM module
{
int len_msg;
len_msg=strlen(msg);
for(i=0;i<len_msg;i++)
{
alpha_sent(msg[i]);
delay(50);
}
}
 
void Ser_init()       //serial port initialised
{
TMOD=0x20;
TH1=0xFD;
SCON=0x50;
TR1=1;
}
 
void LCD_init()       //lcd initialised
{
LCD_cmd(0x38);
LCD_cmd(0x0E);
LCD_cmd(0x01);
LCD_cmd(0x06);
LCD_string("LCD initialisation Done!!");
}
 
void LCD_string(unsigned char *string) //Send a string to LCD
{
int len;
len=strlen(string);
for(i=0;i<len;i++)
{
LCD_alpha(string[i]);
delay(100);
}
}
void LCD_alpha(unsigned char alpha) //Send an alphabet to LCD
{
RW=0;
LCD=alpha;
EN=1;
RS=1;
delay(5);
EN=0;
}
 
void LCD_CMD(unsigned char cmd) //Send Commands to drive LCD
{
RW=0;
LCD=cmd;
EN=1;
RS=0; 
delay(5);
EN=0;
}
 
void delay(int msec) 
{
int j;
for(i=0;i<msec;i++)
{
for(j=0;j<125;j++)
{
}
}
}



Thank You For your Last REPLY it was helpfull.
waiting for your next reply sir.. :)
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top