Problem in interfacing 8051 with gsm module

Hello All, We are a group a students doing our study project. we are trying t interface gsm module with 8051 microcontroller. we are using Atme AT89c51. The problem is that we are also not able to get the data sent t the serial port on the Hyperterminal.we are using the MAX232 driver. Th pin connections are as follows: Pin 10(RXD) of Microcontroller to Pin 12(R1out) of MAX232. Pin 11(TXD) of Microcontroller to Pin 11(T1in) of MAX232. Pin 13(R1in) of MAX232 to Pin3 of DB9 connector. Pin 14(T1out) of MAX232 to Pin 2 of DB9 connector. The value of capacitors used for MAX232 is 1uF. The sample serial port program we have tried is:

-------------------------------------------------------------------------- ORG 0000H; LJMP MAIN; ORG 0030H; MAIN: MOV TMOD,#20H; MOV TH1,#0FDH; MOV TL1,TH1; MOV SCON,#50H; CLR TI; SETB TR1; HERE: MOV SBUF,#'B'; LOOP: JNB TI,LOOP; CLR TI; SJMP HERE; END;

-------------------------------------------------------------------------- Once burnt this code on chip and started there is no data being displaye on the Hyperterminal.

Expecting a help at the earliest.

Thanks in advance.

Reply to
embedidea
Loading thread data ...

First up, I'd start documenting your code - it is even more important when using assembly. I haven't worked with 8051 so, whilst I can work out the flow with educated guesses, I don't know how you are setting up the UART. Labels such as "HERE" don't help much either - try things like TXLOOP or BUF_FILL or whatever that label is doing. Plus you get more marks for comments - it shows you understand the code and are not just asking newsgroups for solutions - oh wait ;-)

Check your hardware and make sure no lines are shorting or open and that you have got the pin numbering correct - it's very easy to get a mirror of what you want because you were looking at the back of the connector when you were soldering.

Get an oscilloscope and look at the data lines and verify that there is activity and that it is at the baud rate you expect with the right amount of data and the right start and stop bits. Then check that those are the settings hyperterminal is using and that flow-control is set correctly. Another favourite is listening on the wrong serial port.

Eliminate the obvious problems before dissecting the code.

Reply to
Tom Lucas

do the max232 connected right an working ? on Pin 2 you should read something like 9 Volt, on pin 6 you shold read

-9 Volt

remove the micro and short-circuit pin 10 and 11 of the micro-socket do you see on hyperteminal the echo of what you write ?

do you have configured the hyperteminal tho the right paramterers? baud rate,parity,stop-bits and no-handshaking ?

the cristal is oscillating and the micro resetted ? add on the loop the instruction to toggle a port bit so you check the micro is running

last thing try: to burn one of the monitor code available on the net.

Reply to
mmm

--------------------------------------------------------------------------

--------------------------------------------------------------------------

-------------------------------------------------------------------------- Hello Thanks for the reply. we have checked all the connections and also th properties of the hyperterminal also. all are correct. but still not abl to get the data. Will there be any problem if we leave the other pins o the DB 9 connector with no connections. Expecting a reply. Thanks in advance.

Reply to
embedidea

do you have the ground pins connected on the DB9?

martin

Reply to
martin griffith

What he said.

Plus are you able to check the signals with a scope?

Reply to
Tom Lucas

able

of

-------------------------------------------------------------------------- Hello Martin, We have connected the pin 5 of DB9 connector to ground. Also th properties set for hyperterminal are 9600 baudrate,no parity,1 stopbit, data bits and no flowcontrol.We have connected the pin 13 (R1in) an

14(T1out) of MAX232 to pins 3 and 2 of DB 9 connector respectively.wil there be any problem if we leave the other pins of DB 9 connector? Expecting a help at the earliest. Thanks in advance.
Reply to
embedidea

If all fails, your only option is to look on the TX line from your board and check the bits and timing of your signal. Another thing noone else mentioned is that your way of testing comms is prone to fail: you are sending one continuous stream of the same character to the computer. There is no way for a receiving uart (your PC) to find a start bit in this stream if there is not at least one short period of "silence" on the line. And further: hyperteminal sucks. If you try to open a com port that already receives data, hyperterminal reports "unable to open port" many times. Use a decent comm program. A good and free one is TeraTerm which can be found on the internet.

Meindert

Reply to
Meindert Sprang
1) Check that pin 20 of the processor is connected to GND 2) Check that pin 40 of the processor is connected to VCC 3) Check that pin 31 of the processor is connected to VCC 4) Check that a suitable reset circuit is connected to pin 9 of the processor. After applying power you should have a logic "1" for some ms and a logic "0" for all the rest of time 5) Check that the processor's oscillator is running by looking with a scope to pins 18 and 19.

MOV TL1,TH1; is surely unnecessary because T1 works as 8-Bit-reload-counter where only TH1 has a meaning. Otherwise your code looks ok, i checked it against my own UART initialization routines. If you don't get the UART running try something more easy, just flipping some port pins around so that you can see whether you get the processor to operation at all.

I guess its something in the hardware

Regards Ulrich

"embedidea" schrieb im Newsbeitrag news:t7-dnTXE_dy2mTTZnZ2dnUVZ snipped-for-privacy@giganews.com...

Reply to
Ulrich Bangert

I dont have the max232 data sheet to hand

Try this:

Remove the processor, short the Tx pin and the Rx pin on the processor socket with a wire. reapply the power.

This will loop through any serial comms through all your hardware. If this works you have a SW problem, if you get nothing or garbage you have a hardware problem.

personally, I'd use C to test it. I use the rasonance complier, the simulator is ok for testing this sort of thing, and its free,and you can look at all the registers etc( but I dont want to start a C vs Asm war.)

martin

Reply to
martin griffith

hello martin,

we are able to send the data to the hyperterminal now. but the same dat when given to GSM modem doesnt work. we are using wavecom's module. w sent the basic at commands as data through UART. the program is a follows.

-------------------------------------------------------------------------- ORG 0000H; LJMP MAIN; ORG 0030H; MAIN: MOV TMOD,#20H;//setting timer 1 MOV TH1,#0FDH;//initalizing timer1 MOV SCON,#50H;//8 databits 1 startbit,1stop bit no parity CLR TI; CLR RI; SETB TR1;//starting timer1 MOV A,#'A';//actully transmitting the command.. MOV SBUF,A;// the command is atdt for dialing ACALL TRANSMIT; MOV A,#'T'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'D'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'T'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'9'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'4'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'4'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'0'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'9'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'5'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'7'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'2'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'9'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#'5'; MOV SBUF,A; ACALL TRANSMIT; MOV A,#03BH; MOV SBUF,A; ACALL TRANSMIT; MOV A,#0DH; MOV SBUF,A; ACALL TRANSMIT; MOV A,#0AH; MOV SBUF,A; ACALL TRANSMIT; HERE: SJMP HERE; TRANSMIT: HERE1: JNB TI,HERE1; CLR TI; RET;

END;

-------------------------------------------------------------------------- we are able to get the data sent on the hyperterminal. but the same whe given to GSM modem doesnt work. please suggest any chages to the code to be made. we are confused if thi is the right way to send at commands from 8051.

Thanks in advance.

Reply to
embedidea

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.