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 support@ccsinfo.com

Need help on communication between GSM-PIC

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



Joined: 28 Feb 2006
Posts: 4

View user's profile Send private message Yahoo Messenger MSN Messenger ICQ Number

Need help on communication between GSM-PIC
PostPosted: Wed Mar 01, 2006 2:20 am     Reply with quote

Hi there,I am a newbie in doing this project.I need some help on this project.

I want my PIC to send a voice call command to my GSM without using the Hyperterminal.Would it be possible?Below are my very 1st testing program but it seem like not working at all.Can somebody help to comment on it?I really appreciate ur help coz i'm really running out of time now.


#include <16F876.h> // Defines chip
#use delay(clock=20000000)
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=38400, XMIT=Pin_c6, rcv=pin_c7, parity=n, bits=8)

#byte portc=7


const int CR=0x0d;

void main()

{

set_tris_c_(0x80)

printf("AT");
putc(CR);
delay_ms(10000);

printf("ATD0126196149;");
putc(CR);


}


Best Regards
tracy
jaime



Joined: 25 Nov 2005
Posts: 56
Location: Porto - Portugal

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

PostPosted: Wed Mar 01, 2006 7:25 am     Reply with quote

Hello

Your GSM works at 38400kbs?

To dial a number you only need to do

printf("atd123456789\r");



Jaime
tracy83



Joined: 28 Feb 2006
Posts: 4

View user's profile Send private message Yahoo Messenger MSN Messenger ICQ Number

PostPosted: Wed Mar 01, 2006 9:02 am     Reply with quote

hi jaime...

ya...my GSM work with 38400kbps.I'll try with ur suggestion and let you know how is it...thanks alot
tracy83



Joined: 28 Feb 2006
Posts: 4

View user's profile Send private message Yahoo Messenger MSN Messenger ICQ Number

urgent help
PostPosted: Sun Mar 05, 2006 1:45 pm     Reply with quote

hi there...

#include <16F876.h> // Defines chip
#use delay(clock=20000000) // Defines delay_clock
#fuses hs, noprotect, nowdt, nolvp
#use rs232(baud=38400, XMIT=Pin_c6, rcv=pin_c7, parity=n, bits=8)

#byte portc=7


void main()

{

set_tris_c(0x80);



printf("AT#SHDN\r");


}

When i sent the above program to my hypertterminal,it only display AT#SHD.can somebody help?
SteveL
Guest







PostPosted: Sun Mar 05, 2006 3:17 pm     Reply with quote

It's because you're using the hardware UART which buffers 2 or 3 bytes (can't remember exactly) so your code sends the characters to the PIC UART buffer for transmission as soon as the current character has finished. But CCS insert a hidden SLEEP instruction after the closing brace of main(). So you send the characters to the PIC buffer, then the PIC hits the sleep instruction & turns off the internal clocks so the characters in the buffer can't be sent.
The simplest thing for testing is to add a delay after the printf of at least 3 bytes (3*8 data bits +1 start bit +1 stop bit) at 38400 baud
or (3*10*(1/38400)) = 781uS so try delay_ms(1).
However this is not good programming and you should avoid letting the code fall out of main() by making an infinite loop.
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