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.

helping sms with 16f876(siemens c55)

Status
Not open for further replies.

cllunlu

Member level 4
Joined
Nov 21, 2006
Messages
76
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,900
helping sms

hi friends
I am trying send sms with siemens c55 by pic 16f876.And I already sent sms with hyperterminal,ı know at command.My schematic link is below.plz help me.And can you edit my mistake.That is so emergency.thnks everbody


https://obrazki.elektroda.pl/15_1185282984.jpg


/////////////////////////////////////////////////////////////////////////////////
#include<iostream>
using namespace std;

#include <stdio.h>
#include<conio.h>


int main ( )
{

unsigned char no []="AT";
unsigned char mno []="+905429800033";
unsigned char mesaj_gonder[] = "AT+CMGS=19";
unsigned char mesaj[] = "0011000C910945447198660000FF05E8329BFD06";


Outp(no);
putchar(0x0D);
puts(mno);
putchar(0x0D);
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo

puts(mesaj); //Message in PDU format
putchar(0x1A); //Control-z tuşu
putchar(0x0D); // Enter tuşuna basılıyor
system("pause");
}
/////////////////////////////////////////////////////////////////////////////////////
 

putchar(0x0d);

cllunlu said:
hi friends
I am trying send sms with siemens c55 by pic 16f876.And I already sent sms with hyperterminal,ı know at command.My schematic link is below.plz help me.And can you edit my mistake.That is so emergency.thnks everbody


https://obrazki.elektroda.pl/15_1185282984.jpg


/////////////////////////////////////////////////////////////////////////////////
#include<iostream>
using namespace std;

#include <stdio.h>
#include<conio.h>


int main ( )
{

unsigned char no []="AT";
unsigned char mno []="+905429800033";
unsigned char mesaj_gonder[] = "AT+CMGS=19";
unsigned char mesaj[] = "0011000C910945447198660000FF05E8329BFD06";


Outp(no);
putchar(0x0D);
puts(mno);
putchar(0x0D);
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo

puts(mesaj); //Message in PDU format
putchar(0x1A); //Control-z tuşu
putchar(0x0D); // Enter tuşuna basılıyor
system("pause");
}
/////////////////////////////////////////////////////////////////////////////////////

In your comment you have CMGS=25 and in your data you have CMGS=19 which one is it ? as far as i know the command is =1 also if I remember correctly CMGS command requires CNTL+Z char to be sent after the message to terminate it.

The structure of your programme is messy, use the functions of a high level language i.e

Code:
void Send_GSM(char *SendData)
{
   Puts(SendData);
   Putc(0x0A);
   Putc(0x0D);
}

int Get_GSM(char *Check)
{
   char MyCheck[20];
   Gets(MyCheck);
   if (istrcmp(MyCheck,Check))
   {
       return 1;
   }
   else
   {
       return 0;
   }
}

void Call_Error(char *Message)
{
  // do some stuff
}

void Main()
{
   Send_GSM("AT");
   if Get_GSM("OK")
   {
      Send_GSM("AT+CMGS=1");
      if Get_GSM(">")
      {
         Send_GSM("0011000C910945447198660000FF05E8329BFD06");
         Send_GSM(0x1A); // CNTL+Z end of message
         if Get_GSM("OK") else Call_Error("Failed to send MSG");
      } else Call_Error("Failed to get > prompt after CMSG command");
   } else Call_Error("Failed to initialize Send MSG");
}

The code is not perfect but it gives you the genral idea, also you may need to change things depending on your compiler, but you see the format you should use to create a clean flow and error checking.

Rethink your code and make it procedural, split data and related code into manageable sections. Data+Code to handle it = Object, Objects = Easy programming.

YOu have the right idea but you need to take a step back and review what you have done so far and take a long look at the data you are sending and also rember that a modem takes time to do things, so you need to wait for the OK or ERROR messages
 

    cllunlu

    Points: 2
    Helpful Answer Positive Rating
helping sms

you must enter a wait after
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo


just like this
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo
delay_ms(2000);//Bekleme süresi

puts(mesaj); //Message in PDU format
 

sms 16f876

otuzsubat said:
you must enter a wait after
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo


just like this
puts(mesaj_gonder); //AT+CMGS=25
putchar(0x0D); // Enter tuşuna basılıyo
delay_ms(2000);//Bekleme süresi

puts(mesaj); //Message in PDU format

I see what you are doing there Otuzsubat, its not usually a good idea to replace a wait for response command with a fixed delay, your method will work 99% of the time for sure, but if the modem fails or is slow one time then it will cause problems, best is to check for the modem response ERROR, OK or > in this case.
 

16f876 schema

void Call_Error(char *Message)
{
// do some stuff
}

what will I do.You said me do some stuff.
I couldnt understand.And my schematic is right?
thnks
 

siemen c55 at+cmgs

I see what you are doing there Otuzsubat, its not usually a good idea to replace a wait for response command with a fixed delay, your method will work 99% of the time for sure, but if the modem fails or is slow one time then it will cause problems, best is to check for the modem response ERROR, OK or > in this case.
you are right foxabilo. My solution is easy but not professional.

void Call_Error(char *Message)
{
// do some stuff
}
1. You can try send sms again
2. You can reset phone and then try to send sms again.
 

    cllunlu

    Points: 2
    Helpful Answer Positive Rating
siemens at command sms cmgs

cllunlu said:
void Call_Error(char *Message)
{
// do some stuff
}

what will I do.You said me do some stuff.
I couldnt understand.And my schematic is right?
thnks

The Call_Error procedure I placed ijn there is just for completenesses you do not have to include it, but if you do you could set some error LED or somthing else to tell the user there is a problem
 

code siemen sms at command

ok foxabile I understand.I will try.But you see my schematic?that is true too?
 

get_gsm 16f876

Are you OK cllunlu ?
you can see carefully AT command for C55.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top