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

GSM-PIC-PC(Hyperterminal)

 
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

GSM-PIC-PC(Hyperterminal)
PostPosted: Wed Mar 08, 2006 4:42 am     Reply with quote

Hi there,i need help in urgent.I'm doing a project of vehicle tracking system.now i want my PIC to send command to both PC and GSM then the GSM response will go to my PIC and from the PIC to my PC. But i donno how to write the code for the sending the command to both GSM and PC.I have wrote a little program but got lots of error coz i'm not good in programmming.Can somebody please give me some advice?else also can give me some example code for this application.

#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, stream=GSM)
#use rs232(baud=38400, XMIT=Pin_c4, rcv=pin_c5, parity=n, bits=8, stream=PC)


#byte portc=7



char string[8];
const int CR=0x0d;
const int LF=0x0a;

void main()

{


set_tris_c(0x80);
set_tris_c(0xA0);



printf("AT&K0",GSM);
putc(CR,GSM);
putc(LF,GSM);
delay_ms(2000);

while(TRUE){

string=gets(GSM);

printf(PC,"\%S",received_from_phone);

}

}



Thanks alot.......
Ttelmah
Guest







PostPosted: Wed Mar 08, 2006 5:30 am     Reply with quote

Key thing missing. fprintf, fputc, and fgets.
Look in the manual for these commands. These are the versions of 'gets', 'putc', and 'printf', that handle streams. At present, your output will be routing to the default input/output, and you will be getting the syntax errors, because the default commands do not allow the use of streams.

Best Wishes
densimitre



Joined: 21 Dec 2004
Posts: 45

View user's profile Send private message

PostPosted: Thu Mar 09, 2006 9:07 pm     Reply with quote

searching in forum you will find the answer........
gorilla135



Joined: 14 Mar 2006
Posts: 8

View user's profile Send private message

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

tracy im doin the same type of project. i am having the same type of problem if you find a solution or anything could u help me also, ill be glad to give any info i have my self.

Ciaran
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