View previous topic :: View next topic |
Author |
Message |
smxabi
Joined: 29 Apr 2006 Posts: 14 Location: Spain
|
ˇ Please help ! I'm becoming crazy |
Posted: Sat Apr 29, 2006 10:41 am |
|
|
I'm starting with an alarm project but the the beginning cannot be worse. I have a GSM modem wavecom compatible and the prototype board PIC16F877A from CCS.
Firs test: With the hyperterminal of win i type ATD639XXXXXX; and my phone ring how I expected
Second test. I connect the prototype board to the modem. In he Pic I load the following and simple programm:
#include <16F877A.h>
#device ICD=TRUE
#include <string.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
void main()
{
output_low (PIN_A5);
printf("ATD639xxxxxx;\r\n");
delay_ms(15000);
output_high (PIN_A5);
printf("ATH\r\n");
}
ˇˇˇ Nothing happen !!!
Thirt test: I Connect the rs232 cable of the prototype board to the hyperterminal of windows. I Push the reset button and in the screen appears the message AT639xxxxxx;
Four test.
I Build a simple Visual basic program :
Is identical to the pic programm. Dials a number
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Dim dwMilliseconds As Long
Private Sub Form_Load()
MSComm1.CommPort = 0 ' seleccionamos com1
MSComm1.Settings = "9600,N,8,1" ' parameters for FBUS
MSComm1.PortOpen = True
End Sub
Private Sub command1_click()
MSComm1.Output = "ATD639xxxxxx;" & vbCrLf
Sleep (15000)
MSComm1.Output = "ATH" & vbCrLf
End Sub
and the phone rings
what is happening
I am very confused
Please help
Thank´s in advance from Spain |
|
![](templates/subSilver/images/spacer.gif) |
rberek
Joined: 10 Jan 2005 Posts: 207 Location: Ottawa, Canada
|
|
Posted: Sat Apr 29, 2006 11:38 am |
|
|
Use a null modem cable when you connect the proto board to the modem. |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Apr 29, 2006 12:08 pm |
|
|
Also, add the changes shown in bold below:
Quote: | #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)
void main()
{
output_low (PIN_A5);
printf("ATD639xxxxxx;\r\n");
delay_ms(15000);
output_high (PIN_A5);
printf("ATH\r\n");
while(1);
} |
The most important change for your current program is the "while(1);"
at the end. It prevents the PIC from going to sleep at the end of
the program. If the PIC goes to sleep, it will not send the last two
characters from the hardware UART. In your program, these characters
are "\r\n". |
|
![](templates/subSilver/images/spacer.gif) |
smxabi
Joined: 29 Apr 2006 Posts: 14 Location: Spain
|
|
Posted: Sat Apr 29, 2006 2:44 pm |
|
|
To rbereck:
Null modem. Is the first thing I had made. Everything looks the same.
To PCM Programmer:
I have made the changes that you suggest. Unfortunately I can hear my phone receiving a call.
I had suspected to the max232 if it only transmit but don´t receive but I make a little programm and works fine
#include <16F877A.h>
#fuses hs,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=pin_C6, rcv=pin_C7)
void main() {
while(true)
{
putc(getc());
}
}
I can receive by siow all I type
I have testing the voltage from pin 2 and 3 of the serial port. I have -9.2 volts at pin 2 and aproximatly the same at pin 3
Any suggestion, please ?
And a lot of thank´s by the quick answer |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sat Apr 29, 2006 3:23 pm |
|
|
I suspect your null-modem cable is wired different from your modem requirements. A simple null-modem cable only uses Tx, Rx and Gnd. Many modems also need a signal on their DTR input and sometimes also on the CTS input.
Is your null-modem cable wired like this one? http://www.lammertbies.nl/comm/info/RS-232_null_modem.html#loop |
|
![](templates/subSilver/images/spacer.gif) |
smxabi
Joined: 29 Apr 2006 Posts: 14 Location: Spain
|
|
Posted: Mon May 01, 2006 4:02 pm |
|
|
I`m very glad for helpul information from Rbereck and Ckielstra. Something I was making bad and finally a NULL MODEM has resolve my problemm. ˇ Rbereck your are right when you say that and 9/10 troubles could be resolve with null modem. !
The null modem I make has the following configuration and works fine:
2 3
3 2
5 5
1 + 4 + 6 (shorcut in connecto one)
1 + 4 + 6(shorcut in connecto two)
7 + 8 (shorcut in connecto one)
7 + 8 (shorcut in connecto two)
Thank´s a lot for all people of the foro who help me |
|
![](templates/subSilver/images/spacer.gif) |
|