HOW TO FIND NEW SMS AND CALL/RING from GSM SIM 300

Status
Not open for further replies.

deekshit

Newbie level 5
Joined
Jan 20, 2014
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
tytryt
Visit site
Activity points
97
Sir, pleas help me..


I have done the project for PIC16F877A SMS send Recive and even also dial all are OK
But my problem is micro controller checking ADC volts evry time continusly so its not find whenever message and call coming. otherwise it will check some times every 30 minuts it will check SMS and Ring I want check immediately whenever it will come either mesage or Ring... inform to controller.

how to find new message and New call wheever its come..



if message will come and stores its not identifies is there any commands to new messages or call otherwise how to check ...pleas let me...

Thanks
 

You have to use interrupts and AT+CNMI=3,1,2,1,1\r command once to set modem to reply when there is a new message. I don't now about incoming call. Maybe you can sense the ring indicator line. Post your code.
 

Sir I have tested GSM SIM 300 interface with PIC 16f877a send SMS & recive and even also dailing every thing is fine with PC and PIC16f877a microcontroller. But my problem is I have to display the GSM data into LCD directly i mean i have to read direct acess i am not reading inbox messages whever its coming the message and ring indication I have tried with LCD its doen't show any thing...is it possible to read in LCD from GSM new data ...like SMS and Ringing..
 

GSM only gives new message indication but you have to use AT+CMGR=x\r to read the message at index x. You have to parse and extract the actual message. Contact me at internetuser2k11(at)gmail(dot)com regarding code.
 

Try ATS0 = n ; n can be any value like 2 , 3 this will let you automatically answer your Call
suppose ATS0 = 3 ; // That means after 3 ring detection the call will be automatically received

Also if you don't want to receive automatically then do one thing Check for The RING String and apply a condition like if Ring Is detected and Some Button is Pressed then MCU send "ATA\r" to receive the Call
 




Thank u sir,,


I have tried the string to display in LCD but it will not show any thing... i think my programming code is problem for intialize the configuration bits its working to send SMS to some nos and dailing to some number but it will not receving any message like OK from GSM SIM and i have read the inbox message... please check ths following code..and replay withme..





Code:
#define _XTAL_FREQ 4000000L
#define HIGH_SPEED 1

#if NINE == 1
#define NINE_BITS 0x40
#else
#define NINE_BITS 0
#endif

#if HIGH_SPEED == 1
#define SPEED 0x4
#else
#define SPEED 0
#endif
#define RX_PIN TRISC7
#define TX_PIN TRISC6


__CONFIG(XT & WDTDIS & PWRTEN & BORDIS & LVPDIS &
 DEBUGDIS & UNPROTECT );

void wait(unsigned char msec);
void Tx_string(const char *string);
void Tx_byte(unsigned char byte);
void clearBuffer();

int i;
char buffer[95];

main()
{
 TRISC=0b11000000;// Rx pin RC7 only i/p others o/ps including Tx pin
 PORTC=0b11000000;
 TRISD=0b00000000;  
 PORTD=0b00000000;
 
 SPBRG = 25;//9600 bud rate
 RCSTA = (NINE_BITS|0x90);
 TXSTA = (SPEED|NINE_BITS|0x20);
 INTCON = 0;
 wait(1000);
 clearBuffer();
 Tx_string("AT\r\n");
   while(1){
   while(!RCIF)
   buffer[i++]=RCREG;
   buffer[i]='\0';
   for(i=0;buffer[i]!=95;i++)
    {
      lcd_goto(0x00+i)
     lcd_putch(buffer[i]);     
     wait(30);
     
    }
}
}
  
void clearBuffer(){
     for(i = 0;i < 95;i++)buffer[i] = ' ';
 
}


void Tx_string(const char *string)
{
   while(*string){
   TXREG=*string;
   while(TRMT==0);
   string++;
  }
}
void Tx_byte(unsigned char byte)
{
  while(TRMT==0); 
  TXREG=byte;
   
 }



void wait(unsigned char msec)
{
 unsigned int i,j;
 for(i=0;i<=msec;i++)
 {
  for(j=0;j<=1000;j++);
 }
}
 
Last edited by a moderator:

I think you have to use UART Receive Interrupts to get the response and parse it using some Pointer or Array and then print it to the LCD ,

I have done that thing but using AVR not with PIC , So try using EUSART Receive Interrupts
 

I think you have to use UART Receive Interrupts to get the response and parse it using some Pointer or Array and then print it to the LCD ,

I have done that thing but using AVR not with PIC , So try using EUSART Receive Interrupts
what you mean by EUSART Receive Interrupts please explain..
 

There are two methods to USART receive in PIC Microcontroller
1st is Polling Like getting data in RCREG Register and there is another method to use it via Interrupts to enable
the Interrupts PIE bits or like that Has to be given a HIGH Logic to enable Interrupts
EUSART is nothing but its enhanced USART nothing it's USART only dud

Like in AVR I will tell you
If i give High Logic to RXCIE bit then UART Receive Interrupt is Enabled
then an algo is that code will jump to Interrupt Service Routine Function
 





Dear Sir I have tested the cde in pc hyperterminal is every thing is OK I have received the message but when i connected to PIC with GSM SIM 300 is not supporting for recieved message i think its not recevied any thing ... it will problem for some thing...
 

There may be the Problem in Receiving the data coming from the modem ,
I suggest you to use UART Interrupt,
but I have used that thing using AVR not PIC ,
Still an idea i can deliver that UART Interrupt will Check for the Receive bits and there by there is a logic which you have already written
Code:
[CODE] while(!RCIF)
   buffer[i++]=RCREG;
   buffer[i]='\0';
   for(i=0;buffer[i]!=95;i++)
    {
      lcd_goto(0x00+i)
     lcd_putch(buffer[i]);     
     wait(30);
     
    }
[/CODE]

- - - Updated - - -

but you have to look over it using the uart interrupts in PIC
 

pleas help me...


I have tested the code in pc hyperterminal for both send &Receive SMS through GSM SIM 300 with PIC 16F877a Micro controller through MAX 232 but when i connect GSm SIM 300 with PIC 16F877a Micro controller its not supporting so without connecting MAX 232 its working only for SEND ing Message and daling the call but its not receiving any thing..without using MAX 232 what is the problem...
 

please help me...


I have to test the GSM SIM 300 response like i have send a command to GSM SIM 300 for ("AT\r\n"); GSM 300 will give a response to PC is OK but I have testing in GSM SIM 300 with PIC microcontroller 16F877A on LCD. how to catch the receiving buffer and then display on LCD for OK . how to find whether it will send OK or error...
Thanks
 

Use ISR to receive serial data and use strstr() or memcmp() functions to test the response.
 

GSM Respose Code display problem

Use ISR to receive serial data and use strstr() or memcmp() functions to test the response.

Sir I have tested for the following code but it will display only for Carrage return(CR) and Line feed (LF)values i have checked the ASCII table. GSM SIM response data add with 0x30 so it will display like =: so it will in the ASCII table check thisless than this values - 0x30 it will for CR and LF but not display like OK
please help me... what are the instructions to do this getting like OK . I think it will not given OK from GSM SIM response please check my code and correct it ...


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
#ifndef _SERIAL_H_
#define _SERIAL_H_
 
#define _XTAL_FREQ 4000000L
 
//#ifndef _SERIAL_H_
#define _SERIAL_H_
 
#define BAUD 9600      
#define FOSC 4000000L
#define NINE 0     /* Use 9bit communication? FALSE=8bit */
 
#define DIVIDER ((int)(FOSC/(16UL * BAUD) -1))
#define HIGH_SPEED 1
 
#if NINE == 1
#define NINE_BITS 0x40
#else
#define NINE_BITS 0
#endif
 
#if HIGH_SPEED == 1
#define SPEED 0x4
#else
#define SPEED 0
#endif
#define RX_PIN TRISC7
#define TX_PIN TRISC6
 
/* Serial initialization */
#define init_comms()\
    RX_PIN = 1; \
    TX_PIN = 1;       \
    SPBRG = DIVIDER;        \
    RCSTA = (NINE_BITS|0x90);   \
    TXSTA = (SPEED|NINE_BITS|0x20)
#endif
__CONFIG(XT & WDTDIS & PWRTEN & BORDIS & LVPDIS &
 
main()
{ 
INTCON = 0;
init_comms();
 wait(10);
 lcd_init();    
 wait(10);
clearBuffer();
lcd_clear(); 
i=0;
Tx_string("AT\r");
while(RCIF){
buffer[i]=RCREG;
i++;
}
buffer[i]= '\0';
 
for(i=0;buffer[i]!='\0';i++)
{
  buffer[i]+= 0x30;
  lcd_goto(0x00+i);
  wait(10);
  lcd_putch(buffer[i]);
  wait(50);
} while(1);   
 
 
void clearBuffer()
{
     for(i = 0;i < 95;i++)buffer[i] = ' ';
 
}




Thanks
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…