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.

[PIC] Sending text message to phone using gsm module and pic 16f876a

Status
Not open for further replies.

stephansbest

Newbie level 4
Joined
Jan 28, 2014
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
53
Hi guys i am working on a project which requires that i send an sms to a phone using sim300 gsm module.I am using pic basic pro, but the test is not been sent
ild be glad if you can help....
i am using pic 16f876a and sainsmart sim300 gsm/gprs module,below is my code
INCLUDE "modedefs.BAS"
Code:
TRISC=%10000000
G1 VAR PORTC.6
G2 VAR PORTC.7
rec var WORD
LED VAR PORTC.0
PAUSE 1000
SEROUT PORTC.6,9600,["AT"]  'check to see if gsm is working
PAUSE 2000
SEROUT PORTC.6,9600,["AT+CMGF = 1",13] 'set the sms mode to text
PAUSE 2000
SEROUT PORTC.6,9600,["AT+CSMP = 17,167,0,0",13]  'set text mode parameters
PAUSE 2000
HIGH G1
serout PORTC.6,9600,["AT+CMGS =",34,"+233501371821",34,13] 'send text to this number
pause 200
serout PORTC.6,9600,["GAS LEAKAGE DETECTED AT HOME PLEASE ATTEND TO IT",26]

Thank you!:)
 
Last edited by a moderator:


Code - [expand]
1
2
3
4
5
6
7
8
SEROUT PORTC.6,9600,["AT+CMGF=1",13] 'set the sms mode to text
PAUSE 2000
SEROUT PORTC.6,9600,["AT+CSMP=17,167,0,0",13]  'set text mode parameters
PAUSE 2000
HIGH G1
serout PORTC.6,9600,["AT+CMGS=",22,"+233501371821",22,13] 'send text to this number
pause 3000
serout PORTC.6,9600,["GAS LEAKAGE DETECTED AT HOME PLEASE ATTEND TO IT",26]

 

I have a successful code but its in C...would it do for you?
 

I have a successful code but its in C...would it do for you?

Thank you guys!
The text has been sent sucessfully,this is what i used
INCLUDE "modedefs.BAS"
DEFINE HSER_TXSTA 24h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
TRISC=%10000000
high portC.6
HSerout ["AT",13,10]
Pause 1000

HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
Pause 500

HSerout ["AT+CMGS=",34,"+233501371821",34,13,10]
Pause 500

HSerout ["GAS LEAK DETECTED",10,13]
HSerout [26]
 

Thank you guys!
The text has been sent sucessfully,this is what i used
INCLUDE "modedefs.BAS"
DEFINE HSER_TXSTA 24h
DEFINE HSER_RCSTA 90h
DEFINE HSER_BAUD 9600
DEFINE HSER_CLROERR 1
TRISC=%10000000
high portC.6
HSerout ["AT",13,10]
Pause 1000

HSerout ["AT+CMGF=1",13,10] 'Set Text Mode
Pause 500

HSerout ["AT+CMGS=",34,"+233501371821",34,13,10]
Pause 500

HSerout ["GAS LEAK DETECTED",10,13]
HSerout [26]
:) Gud you are successful! It feels great when GSM modem listens ur commands and works... Congrats!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top