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.

Register Log in

Pic gsm modem problem

Status
Not open for further replies.

benajad

Newbie level 2
Joined
May 25, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
I have implemented a code for pic16f877a that sends at commands to a modem (gl 6100). I have seen the commands sended by the pic in the hyperterminal and they are right. Also I cand send commands from the hyperterminal to the pic generating an interruption in the pic.
When I send those commands through the hyperterminal the modem responses and send the message.
Im not recieving any signal from the modem. The connections are basicly the next: One 10k resistor from rx pin to 5 V. One resistor from tx pin to 5 V. Those pins are conected to a max 232 and the output to the serial conector to the modem.
The code for the pic is:

Code:
#include <16f877A.h>
#FUSES XT,NOWDT, NOPROTECT,NOLVP
#USE delay( clock = 4000000)
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#use rs232(baud=9600, xmit=pin_c6, rcv=pin_c7, RESTART_WDT, bits=8)


char string[30];
#int_rda 
void serial_isr() {
gets(string);
}

void main() {


  enable_interrupts(int_rda);
  enable_interrupts(global);
    
   delay_ms(1000);
  // lcd_putc("Inicia");
   
 
  while(1){
    printf("AT");
   printf(0x1a);
   printf(0x0d);
  //  delay_ms(2000);
  //  printf("recibio... %s",string);
   delay_ms(1000);
    puts("AT+WIPCFG=1");
    delay_ms(1000);
    puts("AT+WIPBR=1,6");
    delay_ms(1000);
    puts("AT+WIPBR=2,6,11,\"internet.movistar.com.co\"");
    delay_ms(1000);
    puts("AT+WIPBR=2,6,0,\"movistar\"");
    delay_ms(1000);
    puts("AT+WIPBR=2,6,1,\"movistar\"");
    delay_ms(1000);
    puts("AT+WIPBR=4,6,0 ");
    delay_ms(5000);
    puts("AT+WIPCREATE=2,1,\"190.84.22.50\",4420");
    delay_ms(2000);
    puts("AT+WIPDATA=2,1,1");
    delay_ms(2000);
    printf(" \Recibio...");
    delay_ms(1000);
    printf("+++");
    delay_ms(1000);
    puts("AT+WIPCLOSE=2,1");
    delay_ms(1000);
    puts("AT+WIPCFG=0"); 
    delay_ms(5000);
  }
}
Sorry for my english. Thank you very much.
 

horace1

Advanced Member level 5
Joined
Nov 18, 2008
Messages
2,123
Helped
596
Reputation
1,188
Reaction score
573
Trophy points
1,393
Location
Norwich, UK
Activity points
13,071
in your AT command sequence
Code:
    printf("AT");
   printf(0x1a);
   printf(0x0d);
why are you outputting 0x1a (the ASCII SUB character) - did you mean to output 0x0a (ASCII LF)?
 

benajad

Newbie level 2
Joined
May 25, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
sorry is 0a, but still not work
 

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
what is the purpose of putting in while(1) loop

it will execute infinitely and will never stop, this will cause modem to reset again and again..

first test it with hyper terminal and the write the program........
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top