|
|
View previous topic :: View next topic |
Author |
Message |
Carlos Silva Guest
|
AT Commands through a PIC18f2550 |
Posted: Sun Apr 06, 2008 11:42 am |
|
|
hya
can some1 help me in programing a PIC18f2550 to send AT commands in a GSM module so that i can SMS´s through it?
AT
AT+CMGF=1
AT+CMGW="telphone number"
<text>
AT+CMSS=index
This AT commands allow sending SMS´s through the GSM module linked to a PC using hyperterminal
Now i wanna use the PIC instead of the hyperterminal, can you guys help me?
Cheers from Portugal,
Carlos Silva |
|
|
meereck
Joined: 09 Nov 2006 Posts: 173
|
|
Posted: Sun Apr 06, 2008 12:54 pm |
|
|
hi, that is pretty straight-forward:
you configure the UART:
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7, STREAM=GSM,ERRORS)
and then use printf or fprintf function to send characters out of the PIC.
printf("ATcommand\r");
fprintf(GSM,"ATcommand\r"); |
|
|
Samuel Guest
|
|
Posted: Thu Apr 10, 2008 9:39 am |
|
|
we still cant send the at comands using that program that carlos put into the forum, we try to use somthing like this to send a sms in the index 3
void main(){
fprintf(GSM,"AT+CPIN=1983\r");
delay_ms(2000);
fprintf(GSM,"AT+REG ?\r");
delay_ms(2000);
fprintf(GSM,"AT\r");
delay_ms(2000);
fprintf(GSM,"AT+CMGF=1\r");
delay_ms(2000);
fprintf(GSM,"AT+CMSS=3\r");
delay_ms(2000);
}
and nothing lol can some1 help us please |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Thu Apr 10, 2008 9:41 am |
|
|
Need more info:
What were the settings for the PC which worked ? Baud rate etc...
Where is the rest of your code, especially the fuses and #use rs232 settings ?
Does the PIC work when connected to the PC ?
You may need \r\n at the end of the line! |
|
|
Samuel Guest
|
|
Posted: Thu Apr 10, 2008 11:45 am |
|
|
ok this is the code that we are using can u help please?
#include <18F2550.h> //ficheiro .h correspondente à PIC a utilizar
#fuses HSPLL,NOWDT,NOPROTECT,NOLVP,NODEBUG,USBDIV,PLL5,CPUDIV1,VREGEN //fuses configurados para a PIC18F2550
#use delay(clock=48000000) //velocidade de funcionamento
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7, STREAM=GSM,ERRORS)
#include <usb_cdc.h>
void main(){
fprintf(GSM,"AT+CPIN=1983\r");
delay_ms(10000);
fprintf(GSM,"AT+REG ?\r");
delay_ms(10000);
fprintf(GSM,"AT\r");
delay_ms(10000);
fprintf(GSM,"AT+CMGF=1\r");
delay_ms(10000);
fprintf(GSM,"AT+CMSS=3\r");
delay_ms(10000);
} |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|