View previous topic :: View next topic |
Author |
Message |
William
Joined: 11 Sep 2010 Posts: 8
|
RS232 and GSM module |
Posted: Mon Nov 01, 2010 5:35 pm |
|
|
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
|
|
Posted: Tue Nov 02, 2010 4:27 am |
|
|
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
|
|
Posted: Tue Nov 02, 2010 5:46 am |
|
|
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
|
|
Posted: Tue Nov 02, 2010 6:34 am |
|
|
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 |
|
|
|