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

RS232 and GSM module

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



Joined: 11 Sep 2010
Posts: 8

View user's profile Send private message

RS232 and GSM module
PostPosted: Mon Nov 01, 2010 5:35 pm     Reply with quote

Hi, I am trying to get my pic to connect with my GSM module through Serial and the problem I'm having is when i send data to the pic it doesn't receive it. But when I disconnect the GSM module and connected it to hyperterminal all the data that I sent to the pic gets displayed in hyperterminal.

Here is the code basics:
Code:

#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,ERRORS)
.
.
.
.
void main()
{
   while(j == 0)
   {
      c = getc();
      if(c == '1') j =1;
   }
   //the code never gets here. but when i disconnect the GSM module from   //the pic and connected the GSM module to hyper terminal it displays a '1'

}

If anyone can help it would be greatly appreciated.
temtronic



Joined: 01 Jul 2010
Posts: 9225
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Nov 02, 2010 4:27 am     Reply with quote

Simplest error would be not having a 'MAX232' chip on the PIC..
Other possibilty is PIC 5 volt and GSM 3 volt.
IS PIC txg going to GSM rxv and vice versa ?

You don't show a complete program but..
As to the PIC software, you should force j to be 0 in main before the loop.
J could be any value unless it is cleared by you.
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Tue Nov 02, 2010 5:46 am     Reply with quote

Actually simplest error would be wiring.

If he is talking to Hyperterminal OK, then he has the MAX232.

The PC, is a DTE device (terminal), while the GSM module will be a DCE device (modem etc.). If the PIC connects to the PC OK, then his PIC is also wired as a DCE device. Hence attaching GSM module to PIC, he would be trying to connect a DCE device to a DCE device, and would need a 'null modem', or to swap the TX/RX wires.....

Best Wishes
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue Nov 02, 2010 6:34 am     Reply with quote

I agree with Ttelmah, swapping the TX-RX lines.
I had the same problem about a year ago.

I would also suggest using a better terminal program...
so that you can see what its actually being sent/received.
_________________
CCS PCM 5.078 & CCS PCH 5.093
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