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.

gsm module+microcontroller

Status
Not open for further replies.

abdullah qadeer

Newbie level 3
Joined
May 20, 2012
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,318
can anybody post pic16f877a or pic16f84a microcontroller c codes to interface with sim900d gsm module?? project basically is that u receive a sms to ur module and the instruction is passed to ur microcontroller and it turns on a LED.....
 

You can use code of any AT support modem to sim900, it will work fine, when i ported my sim300 code to sim900 it was not sending sms when i added some delay between at commands to worked
 

You can use code of any AT support modem to sim900, it will work fine, when i ported my sim300 code to sim900 it was not sending sms when i added some delay between at commands to worked

bro i need full C code for the microcontroller.........its a project.........turning on or off a light depending upon the text u send to ur module from a mobile number!!!!!!!!!!!
 

abdullah qadeer said:
bro i need full C code for the microcontroller.........its a project.........turning on or off a light depending upon the text u send to ur module from a mobile number!!!!!!!!!!!
Congratulations for this great project and good luck. Nobody is going to make this project for you, or give you "full C code". When you have any problem in specific, you could post it and get help on this problem. If you would like someone to do this project for you, then the EDA Jobs, Promotions, Advertising is the right place to post it.
 

Congratulations for this great project and good luck. Nobody is going to make this project for you, or give you "full C code". When you have any problem in specific, you could post it and get help on this problem. If you would like someone to do this project for you, then the EDA Jobs, Promotions, Advertising is the right place to post it.



ok then this is my code in CCS compiler..i wanto convert it into hitech compiler program..now help
#include <16f877A.h> //ic driver
#use delay(clock=20000000) //clock speed
#use rs232 (baud=115200,xmit=PIN_C6,rcv=PIN_C7,PARITY=N,stream=GSM) //Serial Com Port for GSM

#byte PORTA=5 //define port address
#byte PORTB=6
#byte PORTC=7

#define led1 PIN_A0 //define pin
#define led2 PIN_A1
#define light PIN_C1






//GSM register
int GSM_getsms=0;

//Serial register
char rx_buff;
char rx[80];
int rx_set=0;
int rx_cnt=0;

#int_rda //Serial interrupt to collect gsm data
void serial_isr (){

rx_buff=getc(); //collect sms command
if(rx_buff==0x0A){ //start byte
rx_cnt=0; //reset counter
}
rx[rx_cnt]=rx_buff; //move received data to array
rx_cnt++; //counter +1

if(rx[0]==0x0A && rx_buff==0x0D)
{ //end byte receive
rx[0]=0;
rx_set=1; //valid set data received
}
}

void main () //main program
{

set_tris_a(0x00); //define io pin; 1:input;0:eek:utput
set_tris_b(0xFF); //A0-A3:eek:utput,B0-B5:input,c0-c2:eek:utput
set_tris_c(0x00);

port_b_pullups(true); //enable pull up at port b

setup_port_a(NO_ANALOGS); //no analog signal

PORTA=0; //off all leads
PORTB=1;
PORTC=0; //off all portc output

enable_interrupts(GLOBAL);

fprintf(GSM,"AT+CMGD=1\r"); //Delete message, \r: return key
delay_ms(1000);

do
{
{



if(rx_set==1){
rx_set=0; //reset

if(rx[3]=='T' && rx[4]=='I'){ //SMS received +CMTI: "SM",1
printf("AT+CMGR=1\r"); //Get SMS
}
if(GSM_getsms==1){ //Get Message
GSM_getsms=0;


if(rx[1]=='1'){ // Light

if(rx[2]=='0'){
output_low(light);
output_low(led2);
}
if(rx[2]=='1'){
output_high(light);
output_high(led2);
}
}
}

delay_ms(2000); //wait for GSM process
printf("AT+CMGD=1\r"); //Free memory
delay_ms(1000);
}

if(rx[3]=='G' && rx[4]=='R');{ //Prepare get SMS +CMGR:
GSM_getsms=1;
}

rx[4]=0; //Free memory
rx[5]=0;
}

timer++;
}while(TRUE);
}
 

the first message should be "AT" followed by 0x0a 0x0d to init modem same to send buad rate
better drive modem in 9600 communication speed
check the commands
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top