|
|
View previous topic :: View next topic |
Author |
Message |
tracy83
Joined: 28 Feb 2006 Posts: 4
|
GSM-PIC-PC(Hyperterminal) |
Posted: Wed Mar 08, 2006 4:42 am |
|
|
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
|
|
Posted: Wed Mar 08, 2006 5:30 am |
|
|
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
|
|
Posted: Thu Mar 09, 2006 9:07 pm |
|
|
searching in forum you will find the answer........ |
|
|
gorilla135
Joined: 14 Mar 2006 Posts: 8
|
|
Posted: Wed Mar 15, 2006 9:02 am |
|
|
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 |
|
|
|
|
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
|