CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Cellphone PIC interaction

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
falonsos



Joined: 01 May 2010
Posts: 5

View user's profile Send private message

Cellphone PIC interaction
PostPosted: Wed May 19, 2010 2:54 pm     Reply with quote

Hello!

I'm making a project to send and receive SMS using a Siemens C66 and a PIC 16F877a.

I can send SMS (using PDU mode) but I haven't tried to receive SMS yet. First I tried to send "AT" to get the response "OK" but all I get from the cellphone is "at", no matter what I send him (I tried with several commands).

The code I'm using is:
Code:

#include <16F877A.h>
//#device adc=8
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES RC                       //Resistor/Capacitor Osc with CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected

#include <math.h>
#include <string.h>
#include <kbd44.c>
#include <lcd.c>

void main()
{
lcd_init();

while(TRUE){
  delay_ms(100);
  printf("AT\n\r");
  while(TRUE){//i read all the time to get whats going on
     if(kbhit()){
         reci = getc();
         printf(lcd_putc,"%c",reci);//print on LCD to see whats going on
     }
  }
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed May 19, 2010 5:20 pm     Reply with quote

Quote:
#include <16F877A.h>
//#device adc=8
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,bits=8)

#FUSES NOWDT //No Watch Dog Timer
#FUSES RC

The RC fuse is wrong for 20 MHz operation. You should use HS.

Also, you have a big delay_ms() statement in your code, so add
the 'ERRORS' parameter to clear any UART Rx overrun errors that
may occur while inside the delay. Example:
Quote:
#use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7,bits=8, ERRORS)
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

View user's profile Send private message Visit poster's website

PostPosted: Thu May 20, 2010 9:39 am     Reply with quote

Not all phones support _all_ AT commands. Check your phone's manual or online forums to see if you can read SMSes from your phone. On my Nokia 3500c, I can send SMSes using AT commands, but I can't read them :-| (don't know why they'd not implement something like that, though).

Rohit
falonsos



Joined: 01 May 2010
Posts: 5

View user's profile Send private message

PostPosted: Thu May 20, 2010 1:50 pm     Reply with quote

Thanks a lot PCM programmer, I implement what you just wrote but I still don't have any results, I still receive an "echo" from the cellphone. (what I send through the PIC is the same I'm receiving. But only when I put AT+XXX. If I don't put the AT before the message I don't get a response).

I have just check that the cellphone able to read SMS with AT commands, but what I think is still strange is that I receive an echo (exactly what I send).

Thanks in advance.
sjb



Joined: 13 Apr 2010
Posts: 34
Location: UK

View user's profile Send private message

Re: Cellphone PIC interaction
PostPosted: Fri May 21, 2010 12:39 am     Reply with quote

falonsos wrote:
The code I'm using is:
Code:

  printf("AT\n\r");

Are you sure about that line end sequence. That now even DOS(which would be \r\n.

According to wikipedia the HAYES command set needs just a CR ('\r') to complete the command.
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri May 21, 2010 6:50 am     Reply with quote

hi,

yo could try using a SE T290A ... sends and recieves txt msgs......its what i use with much success

i posted code to recieve text sms on the "code Library" part of this forum

under "recieving TXT messages"


you can look at some of my routines....for proper comands.....

i think "sjb" might have a point in the end line sequence....

i send my returns as hex chars.... and NO Newline.......

take a look....

http://www.ccsinfo.com/forum/viewtopic.php?t=42527

Gabriel
_________________
CCS PCM 5.078 & CCS PCH 5.093
falonsos



Joined: 01 May 2010
Posts: 5

View user's profile Send private message

PostPosted: Sun May 23, 2010 11:51 am     Reply with quote

I solved the problem.

It was that i get each char and then print it on the LCD screen wasting time on that, so i missed a lot of chars coming on Rx while printing.


Thanks a lot for your help!

Also, i hope this topic would help other people to.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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