Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

PIC16F877A failed to send to gsm modem..

Status
Not open for further replies.

lazyhut

Member level 1
Joined
Feb 14, 2011
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,467
HELP...PIC16F877A failed to send to gsm modem..

gsm modem model: MOD 9001D RS232 GSM/GPRS
Microcontroller: PIC16F877A
software:MikroC

I am newbie in mikro C programming and AT command to send SMS in microcontroller.
I tried this Command code via hyperterminal it worked.
i have connect it with PIC16F877A via max232
My problem is:
when connect using microcontroller it won't send message to my phone and reply data from gsm modem.



Hypertiminal Command:
Code:
AT+CMGF=1 [enter]
O.K           [received]
AT+CMGS="xxxxxx" [enter]
>              [received]
Testing123 ctr+Z [sent]

Programming:
Code:
void ADC_value_to_PC(){

uart1_write_text("at+cmgf=1");
UART1_Write(13);
UART1_Write(10);
delay_ms(5000);

UART1_Write_text("AT+CMGS=\"xxxxxxx\"");
UART1_Write(13);
UART1_Write(10);
delay_ms(5000);

UART1_Write_Text("Testing123");
UART1_Write(0x1A);
}

void main() {
TRISA=0x01;                    //I/O declarations
TRISB=0x00;
TRISC=0x00;
TRISD=0x00;
TRISE=0x00;

PORTA=0xFE;                    //Ports declarations
PORTB=0x00;
PORTC=0x00;
PORTD=0xff;
PORTE=0x07;

uart1_init(9600);
delay_ms(5000);
ADC_value_to_PC();            //Call function
}

below is my connection of max232 via mircocontroller
17_1297690665.jpg
 
Last edited:

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
you can swap tx and rx pin on one end of cable and try... sometimes pc and controllers use cross cable...

i dont see you sending 0x0d and 0x0a combination eqvivalent to enter on keyboard
 

lazyhut

Member level 1
Joined
Feb 14, 2011
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,467
you can swap tx and rx pin on one end of cable and try... sometimes pc and controllers use cross cable...

i dont see you sending 0x0d and 0x0a combination eqvivalent to enter on keyboard

Enter Key = <CR> + <LF>
Code:
UART1_Write(13);
UART1_Write(10);

<CTRL> + Z = 0x1A
Code:
UART1_Write(0x1A);
 

DineshSL

Advanced Member level 1
Joined
May 10, 2010
Messages
403
Helped
121
Reputation
242
Reaction score
116
Trophy points
1,343
Location
Sri Lanka
Activity points
3,551
Hi lazyhut,

Instead of using 5s delay after AT+CMGS command, you can read modem output for that command.

Check modem datasheet for correct response for AT+CMGS command and compare it with received string. After receiving correct response you may enter message-Text.

It might work with 5s delay but checking response will ensure correct operation.

Thank you,
 

lazyhut

Member level 1
Joined
Feb 14, 2011
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,467
connect pic to terminal and see if code is working properly with the same cable that you use for testing modem and terminal....

yes...jz try it...i connect pic to hyper terminal...it can sent out properly..
but when switch to modem..it still wont work...
i think is my programming problem...
 

lazyhut

Member level 1
Joined
Feb 14, 2011
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,467
there were post earlier with same problem with many people...

check these links

https://www.edaboard.com/thread192604.html

are testing baud rate and pic baud rate same??? try swapping cable tx and rx at one end and try....

same...still wont work...gsm modem still cannot send to my phone...T.T

---------- Post added at 12:26 ---------- Previous post was at 10:44 ----------

there were post earlier with same problem with many people...

check these links

https://www.edaboard.com/thread192604.html
are testing baud rate and pic baud rate same??? try swapping cable tx and rx at one end and try....

hi sir, now i can send from my gsm modem to my phone already....
btw, how to receive from GSM modem...
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top