Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem connecting pic18f452 with wavecome modem through max232

Not open for further replies.


Junior Member level 2
Jan 11, 2011
Reaction score
Trophy points
Activity points
this is my code below that i am using with pic18f452 using wavecom gsm modem through max232 ic.....but i do not know why it doesnt work....i simulate it using proteus and it works the only thing is when i set in my code baudrate of 19200 the the virtual terminal baudrate is set to 9600 to see the at command pop up at the virtual terminal....pls help me guys.

#define intruder PORTB.f7
#define button_ON PORTB.f6
#define blockcar PORTD.f7


int enter = 0X0D; // COMMAND FOR ENTER
char i;
void main()
trisb = 0xff; // SET PORTB AS INPUT
trisd = 0x00; // SET PORTD AS OUTPUT
trisc.f7 = 1; // SET Rx DATA IN
trisc.f6 = 0; // SET Tx DATA OUT

goto ON;
else if (button_ON==1)
{ if((button_ON==1)&&(intruder==1))
goto SSMS;
{ for(i=0;i<10;i++)

while (1)
{ blockcar=1; // BLOCKING THE CAR
if (button_ON==0) // WAIT FOR USER INTERRUPT

first test wavewcom modem with hyperterminal and with 9600 baudrate and see if it works for AT commands....
then connect the PIC board to hyperterminal and set baud rate to 9600 and see if the program responds to the response you type in the terminal instead of modem.... if these two combination works then connect PIC board to modem.....

REMEMBER: Wavecom modem uses a cross cable.. in real application you may need to change the tx and rx connection of the cable and make it cross........

i have tested wavecom modem with hyperterminal at 9600 baudrate and it works do i need to program my pic at 9600 baudrate or other baudrate.....because for virtual terminal to work on proteus.....i need to change the code baud rate to 19200 for virtual terminal baudrate at 9600 to see the at+cmss command on the terminal.

program it for 9600, and test it with hyperterminal by giving the response yourself instead of modem... if it does not work on virtual terminal, then connect pic board to hyper terminal and test

actually the program is to send sms to my handphone to tell me if there is an how do i test it with hyperterminal? can i connect a rs232 cable from (db9 pic) to hyperterminal directly?if i do what would i expect to see.....

you have to connect the cable to PC and the PIC UART connector... your program will send the AT command you can see it on the window... then instead of modem you have to type the response. the controller has to wait for the response and then only proceed to the next AT command. check if the flow of the code is correct.....and baudrate...

---------- Post added at 00:27 ---------- Previous post was at 00:26 ----------

you should execute the program and the program should print intruder alert on the hyperterminal

ok ill try this tomorrow....because i have to get a female socket.....i will connect the db9 to the pic via a max232 ic and use hyperterminal to troubleshoot it am i right?

---------- Post added at 06:54 ---------- Previous post was at 06:06 ----------

i just would like to ask....i read in ur earlier post for connecting with wavecome gsm modem.....if my serial cable came with the module then i do not need to swap the rx and this serial cable is actually 25 pin on one side which is connected to the modem and db9 pin on the other.....when i test to send mesage with hyperterminal it works i still have to swap rx and tx....just asking to eliminate this possibility.

Usually Wavecom modem serial cable are always cross cable.. using multimeter, check the tx and rx connection and ground..

pin pin
2 3
3 2
5 5

if the connection is like this then not a problem... but you should see how it is connected on the controller board... on the controller side you should swap it. Make a small cable of your own with tx, rx , and ground. So that you dont need to tamper the original cable..

---------- Post added at 08:04 ---------- Previous post was at 08:03 ----------

cross cable of the modem works with PC and not controller. that's my experience...

i have tested the program with hyperterminal......i connected the pic mcu with rs232 and connected it to hyperterminal through a serial when i on switches 1 and 2 on the circuit it should appear at+cmss=1 on the hyperterminal shown on the proteus simulation on the top forum......but unfortunately its not showing.....i adjusted the baudrate to 9600 and also changed it to 4800 but nothing is showing......the connection i did on the breadboard is as same as the picture above in proteus......why is it still not working?

are you using the same serial cable for testing the PIC board which you used for testing wavecom modem.... if yes then the PIC board will have tx and rx pins swapped...

try to swap the connections of tx and rx at one end of the cable and test it again... check the baudrate of the program and the hyperterminal properly once again......

ok the circuit is on a breadboard as the above i have the pic,rs232,switches and so on.....i connected as the above pic on the breadboard.....then i connected the db9 female port as the above pic to the rs232 as on the breadboard......from there im not using the wavecom rs232 cable rs232 to usb converter cable to the hyperterminal.....this cable works fine with the modem initially so i dont think its a problem with the converter cable......i set the baudrate to 9600 as on the as i press both switches at+cmss=1 should show on the hyperterminal my connection correct?

---------- Post added at 21:32 ---------- Previous post was at 21:07 ----------

if i swap tx and rx that means i need to swap the input at the max232 ic rite .....between pin 7 and 8 on the picture above rite

sir, can u pls upload the best connection between the wavecom modem rs232 and pic connections pls......i just need to check with mine.....and sir can u pls check my code posted is it suitable for it with wavecom modem pls sir...

i have made a cross cable connected it to hyper terminal and troubleshoot it.....if i put 9600 baudrate in the code then in hyperterminal i have to set 4800 baudrate and that also i get only single characters like a then u then not getting AT+cmss=1 why is this?

because when i set it to the 9600 and set the code at 9600 there is nothing on hyperterminal.....when i set it at 4800 i see only single character each time i turn the switches high....what should i the code correct?

Its purely coding mistake as modem works fine and the PIC board does not work with hyperterminal.. so look if you are using any interrupt or any mistake in your program.... if your PIC board can communicate with hyperterminal with proper baud rate of 9600, then you program will work.....

sir i have the modem sending message to my handphone via the modem i just need to adjust the code so that when i send sms to the modem, the mcu reads it and turns on the alarm.....i do not know how to do that......sir do u know any example code that i can use as refference?

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to