kkelis
Joined: 13 Dec 2006 Posts: 5
|
Receiving sms on wavecom modem |
Posted: Tue Mar 06, 2007 11:45 am |
|
|
Hello everyone.
I know this topic has been discussed before but unfortunately i couldnt find a solution to my problem.
I am trying to interface a PIC18f452 to a wavecom WMOD2A gsm modem.
So far i was able to send sms and dial a number using a PIC. I also managed to receive sms using a terminal program however i was unable to receive the responses from the modem using the PIC.
Code: |
#include <18F452>
#fuses HS,NOOSCSEN,NOPROTECT,NOBROWNOUT,NOWDT,NOSTVREN,NOLVP,PUT
#use delay(clock=8000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, errors)
#include <input.c>
#include<string.h>
#include "lcd.c"
#define MAX_BUFFER 20
char string[20];
#INT_RDA
void int_sra()
{
output_high(pin_b3);
get_string(string,MAX_BUFFER);
}
void main()
{
lcd_init();
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
for(;;)
{
delay_ms(1000);
output_high(pin_b4);
printf("ATE0");
putc(13);
delay_ms(1000);
printf("AT");
putc(13);
delay_ms(1000);
output_low(pin_b4);
delay_ms(1000);
printf(lcd_putc, "\fModem=%s",string);
delay_ms(10);
output_low(pin_b3);
}
}
|
What i am trying to do here is to send "AT" to the modem and get the response "OK" on the LCD.I also have 2 LEDS blinking just to show the program is running. The program works ok when i send data from my terminal program. When i connect my development board to the modem i think it hangs up in the INT_RDA.
In the string the "OK" response is there as i can see using my ICD but i dont understand why the program hangs up. The modem sends the CR,LF characters at the end of each response so the program should exit int_rda right?
Thanks for your time and any help is really appreciated |
|