Interfacing PIC 16f877a with SIM900D

14 posts / 0 new
Last post
Humad Ahmed
imblackzero's picture
Offline
Joined: 18/10/2011
Posts: 4
Points: 205
Interfacing PIC 16f877a with SIM900D

I am currently doing a project on PIC 16f877a with SIM900D GSM MODULE. The purpose of this GSM MODULE is to send an SMS to a number and then wait for response. Based on the response, it would call functions from the PIC 16f877a. I need immediate help in writing the code in C to generate a menu and send it to a mobile number.I am currently using MPLAB IDE 8.80... 

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Ahmed,

 

Good Project, if you could do coding on your own you can learn much more, suggest you to start from your side i will support you to complete your project.

 

Learn below topics to start coding:

 

Basic AT commands for SMS.

Serial Communication(UART) through microcontroller.

 

All the Best !!!

Humad Ahmed
imblackzero's picture
Offline
Joined: 18/10/2011
Posts: 4
Points: 205

 

Well, This is the code i have come up with, but the problem is that the AT Commands keep on looping when i run simulation in Proteus...
 
#include<pic.h>
 
char gsmat1[3]="AT\r";
char gsmat2[10]="AT+CMGF=1\r";
char gsmat3[22]="AT+CMGS=\"03219396419\"\r";
char gsmat4=26;
 
void SerialInit()
{
TRISC6=0;
TRISC7=1; 
TX9=0;
SPBRG=64;
BRGH=1;
SYNC=0;
SPEN=1;      
TXEN=1;
RX9=0;
CREN=1;
}
 
void delay(unsigned long y)
{
int i=0;
for(i;i<y;i++);
}
 
void SerialTX(unsigned char c)
{
while(TXIF==0);
TXREG=c;
 
}
 
void send(unsigned char *s)
{
int i=0;
while(s[i]!='\0')
{
while(TXIF==0);
TXREG=s[i];
i=i++;
delay(15000);
}
delay(15000);
}
 
void main (void)
{
SerialInit();
delay(15000);
while(!TXIF);
send(gsmat1);
delay(15000);
TXREG==0;
TXEN==0;
}
srikanth
shubham436's picture
Offline
Joined: 03/05/2012
Posts: 11
Points: 55

Hi Amrith,

 

     Could you tell me the best way to learn CCS coding ..

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Ahmed..

 

Good. Will get back to you with a solution in short time.

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Srikanth,

 

Suggest you to visit Texas Instrument web site, they provide you online training with videos. Also you will find much more stuff on CCS.

srikanth
shubham436's picture
Offline
Joined: 03/05/2012
Posts: 11
Points: 55

  

 

   Amrit ,

 

           I mean CCS C compiler programming for PIC microcontrollers..

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Srikanth,

 

I thought that you were asking about CCS(Code Composer Studio IDE), Very familiar IDE used on multiple platforms.

 

For CCS C compiler (Custom Computer Service), you can vist ccsinfo.com, there you can find example progrms for different PIC controllers & tutorials for beginners, if you are a beginner start writing basic code using port pins to blink LED e.t.c

srikanth
shubham436's picture
Offline
Joined: 03/05/2012
Posts: 11
Points: 55

 

 

   I did small projects  with LEDs, and ADC...

 

    But for LCD i got many doubts.. specially using with predefined functions..

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Ahmed,

 

Check the function send();

 

You may not be clearing the bits after each transmission. 

srikanth
shubham436's picture
Offline
Joined: 03/05/2012
Posts: 11
Points: 55

 

 

  Hi Amrit,

 

 

              I successfully sent SMS using SIM 300 modem wit PIC microcontroller.  Is it possible to send SMS to multiple numbers at a time??

Amrith
amrith's picture
Offline
Joined: 23/04/2012
Posts: 224
Points: 1000

Hi Srikanth,

 

Well Done !!!

 

It is not possible to send SMS to multiple numbers at a time. The only way to send SMS to multiple numbers is to provide some time delay after each SMS is sent.

srikanth
shubham436's picture
Offline
Joined: 03/05/2012
Posts: 11
Points: 55

 

 

Thnx  Amrith ,

 

 

       Now im tryin to make a  voice call...

midhun
midhun raveendran's picture
Offline
Joined: 05/06/2012
Posts: 25
Points: 65

AT command for making a voic call is ATD********* ;

TRY THIS.

Login or register to post comments
You are here