Interfacing PIC 16F628A to a modem

Status
Not open for further replies.

TeleStudent

New Member
Hello everybody, i would like some help in doing my project and it is basically a PIC ( 16F628A) interfaced to a GSM modem (WAVECOM FASTRACK M1306B ) where i will use the AT commands to send (only) a simple SMS to a phone number.

the problem is that i can not seem to get the AT commands to be sent from the PIC to the GSM modem and in order to identify the problem i did the following steps:

1- Check the connections and voltage drop in every important pin and everything turned out fine.

2- Test the GSM modem by connecting it the PC using hyperTerminal and i was able to send SMS to my phone.

3- After programming my PIC to send the AT commands i connected my circuit to my computer ( PIC 16F628A + MAX232) using hyperTerminal and it showed everything as expected.

and below is the schematic and the code of my project.

NOTE:my GSM modem has a VGA port so the person that provided me the GSM modem gave me a cable that converts the VGA connection to a RS232 DB 9 (Female) connection.

(I am using MikroC Compiler )

Code:
void main(){
CMCON = 7;                          //Disable Comparators
UART1_init(9600);                   //Initiate baud rate to 9600
Delay_ms(100);                      //Delay 1 second
UART1_Write_Text("AT+CMGF=1");       //Write "AT+CMGF=1"
UART1_Write(0x0D);                  //<CR> mean (ENTER)
Delay_ms(100);						//Delay
UART1_Write_Text("AT+CMGS=");       //Write "AT+CMGS="
UART1_Write(0x22);                  //Write (")
UART1_Write_Text("xxxxxxxxxxxx");  //Number SMS send to
UART1_Write(0x22);                  //Write (")
UART1_Write(0x0D);                  //<CR> mean (ENTER)
Delay_ms(100);                      //Delay
UART1_Write_Text("hi");             //Words to be sent
UART1_Write(26);                    //Write "ctrl+z"
Delay_ms(100);                      //Delay
}
 

Attachments

  • New.jpg
    98.3 KB · Views: 527
Last edited:
Connect the modem to the PC with the cables provided.. Access the register in the modem, and see if you can disable hardware handshaking... If not you need to connect RTS & CTS on the modem side ( pins 7 & 8 of the 9 pin connector ).
 
By the way,i found a piece of info on the web and i really appreciate it if you help me verify its contents.

For references purposes : It is quoted from "Laktronics" from "edaboard.com" forums.

 
What GSM modem do you have? Most modems are hardware handshake by default ie... all 9 pins of the 9 pin connector are used... If you need to connect it with only three wires then you must configure the modem on the PC first.. most modems use the standard AT command set to change internal settings ie... ATS0 = register 0 ATS1 register 1 and so on.

This way you can change baud rates and such... Have you got the datasheet?
 
Page 216 of the manual explains the flow control. set both to none AT+lfc=0,0 default (as I said was 2,2 ) that is RTS and CTS are on.

lfc means local flow control.
 
Still it does not work even after i change "the local flow control" to (0,0)..do u have any other suggestions ? ...i really appreciate your help and could you check the code and the schematic above.
 
Just connect pins 7 and 8 on the 9 pin connector. Sometimes there is a "saving" feature... any changes applied will only take effect after writing to this register. I don't really relish reading the entire document. As its only this issue your having, just connect the two pins.
 
You say it works with hyperterminal? You can send an SMS to a mobile phone when connected to the PC?

Then what happens when you connect the PC directly to the pic? Can the PC read the pic?....If so then you are connecting the modem up incorrectly... A modem is connected as a DTE which means rx is connected to rx and tx to tx, I suspect you have it connected null modem (means NOT modem ) swap pins 2 and 3 on the pic board...When you connect to a PC you'll need to swap it back.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…