EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Problem in interfacing 8051 with gsm module

Started by embedidea July 3, 2006
Hello All,
We are a group a students doing our study project. we are trying to
interface gsm module with 8051 microcontroller. we are using Atmel
AT89c51. The problem is that we are also not able to get the data sent to
the serial port on the Hyperterminal.we are using the MAX232 driver. The
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 displayed
on the Hyperterminal.

Expecting a help at the earliest.

Thanks in advance.




"embedidea" <mithun31@gmail.com> wrote in message 
news:t7-dnTXE_dy2mTTZnZ2dnUVZ_oGdnZ2d@giganews.com...
> Hello All, > We are a group a students doing our study project. we are trying to > interface gsm module with 8051 microcontroller. we are using Atmel > AT89c51. The problem is that we are also not able to get the data sent > to > the serial port on the Hyperterminal.we are using the MAX232 driver. > The > 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 > displayed > on the Hyperterminal. > > Expecting a help at the earliest. > > Thanks in advance.
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.
embedidea wrote:
> Hello All, > We are a group a students doing our study project. we are trying to > interface gsm module with 8051 microcontroller. we are using Atmel > AT89c51. The problem is that we are also not able to get the data sent to > the serial port on the Hyperterminal.we are using the MAX232 driver. The > 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.
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.
> 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 displayed > on the Hyperterminal. > > Expecting a help at the earliest. > > Thanks in advance. > > > >
> >"embedidea" <mithun31@gmail.com> wrote in message >news:t7-dnTXE_dy2mTTZnZ2dnUVZ_oGdnZ2d@giganews.com... >> Hello All, >> We are a group a students doing our study project. we are trying to >> interface gsm module with 8051 microcontroller. we are using Atmel >> AT89c51. The problem is that we are also not able to get the data sent
>> to >> the serial port on the Hyperterminal.we are using the MAX232 driver. >> The >> 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 >> displayed >> on the Hyperterminal. >> >> Expecting a help at the earliest. >> >> Thanks in advance. > >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. > > >
-------------------------------------------------------------------------- Hello Thanks for the reply. we have checked all the connections and also the properties of the hyperterminal also. all are correct. but still not able to get the data. Will there be any problem if we leave the other pins of the DB 9 connector with no connections. Expecting a reply. Thanks in advance.
On Mon, 03 Jul 2006 10:07:18 -0500, in comp.arch.embedded "embedidea"
<mithun31@gmail.com> wrote:

>> >>"embedidea" <mithun31@gmail.com> wrote in message >>news:t7-dnTXE_dy2mTTZnZ2dnUVZ_oGdnZ2d@giganews.com... >>> Hello All, >>> We are a group a students doing our study project. we are trying to >>> interface gsm module with 8051 microcontroller. we are using Atmel >>> AT89c51. The problem is that we are also not able to get the data sent > >>> to >>> the serial port on the Hyperterminal.we are using the MAX232 driver. >>> The >>> 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:
>-------------------------------------------------------------------------- >Hello >Thanks for the reply. we have checked all the connections and also the >properties of the hyperterminal also. all are correct. but still not able >to get the data. Will there be any problem if we leave the other pins of >the DB 9 connector with no connections. >Expecting a reply. >Thanks in advance. >
do you have the ground pins connected on the DB9? martin
"martin griffith" <mart_in_medina@yahoo.esXXX> wrote in message 
news:t6dia29o1k1g0g0iatiithml26f99phof2@4ax.com...
> On Mon, 03 Jul 2006 10:07:18 -0500, in comp.arch.embedded "embedidea" > <mithun31@gmail.com> wrote: > >>> >>>"embedidea" <mithun31@gmail.com> wrote in message >>>news:t7-dnTXE_dy2mTTZnZ2dnUVZ_oGdnZ2d@giganews.com... >>>> Hello All, >>>> We are a group a students doing our study project. we are trying to >>>> interface gsm module with 8051 microcontroller. we are using Atmel >>>> AT89c51. The problem is that we are also not able to get the data >>>> sent >> >>>> to >>>> the serial port on the Hyperterminal.we are using the MAX232 >>>> driver. >>>> The >>>> 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: > >>-------------------------------------------------------------------------- >>Hello >>Thanks for the reply. we have checked all the connections and also the >>properties of the hyperterminal also. all are correct. but still not >>able >>to get the data. Will there be any problem if we leave the other pins >>of >>the DB 9 connector with no connections. >>Expecting a reply. >>Thanks in advance. >> > do you have the ground pins connected on the DB9? >
What he said. Plus are you able to check the signals with a scope?
>>Hello >>Thanks for the reply. we have checked all the connections and also the >>properties of the hyperterminal also. all are correct. but still not
able
>>to get the data. Will there be any problem if we leave the other pins
of
>>the DB 9 connector with no connections. >>Expecting a reply. >>Thanks in advance. >> >do you have the ground pins connected on the DB9? > > >martin >
-------------------------------------------------------------------------- Hello Martin, We have connected the pin 5 of DB9 connector to ground. Also the properties set for hyperterminal are 9600 baudrate,no parity,1 stopbit,8 data bits and no flowcontrol.We have connected the pin 13 (R1in) and 14(T1out) of MAX232 to pins 3 and 2 of DB 9 connector respectively.will there be any problem if we leave the other pins of DB 9 connector? Expecting a help at the earliest. Thanks in advance.
"embedidea" <mithun31@gmail.com> wrote in message
news:982dnVNxgoVuZzTZnZ2dnUVZ_rSdnZ2d@giganews.com...
> Hello Martin, > We have connected the pin 5 of DB9 connector to ground. Also the > properties set for hyperterminal are 9600 baudrate,no parity,1 stopbit,8 > data bits and no flowcontrol.We have connected the pin 13 (R1in) and > 14(T1out) of MAX232 to pins 3 and 2 of DB 9 connector respectively.will > there be any problem if we leave the other pins of DB 9 connector? > Expecting a help at the earliest. > Thanks in advance.
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
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" <mithun31@gmail.com> schrieb im Newsbeitrag
news:t7-dnTXE_dy2mTTZnZ2dnUVZ_oGdnZ2d@giganews.com...
> Hello All, > We are a group a students doing our study project. we are trying to > interface gsm module with 8051 microcontroller. we are using Atmel > AT89c51. The problem is that we are also not able to get the data sent to > the serial port on the Hyperterminal.we are using the MAX232 driver. The > 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 displayed > on the Hyperterminal. > > Expecting a help at the earliest. > > Thanks in advance. > > > >
On Tue, 04 Jul 2006 00:21:55 -0500, in comp.arch.embedded "embedidea"
<mithun31@gmail.com> wrote:

>>>Hello >>>Thanks for the reply. we have checked all the connections and also the >>>properties of the hyperterminal also. all are correct. but still not >able >>>to get the data. Will there be any problem if we leave the other pins >of >>>the DB 9 connector with no connections. >>>Expecting a reply. >>>Thanks in advance. >>> >>do you have the ground pins connected on the DB9? >> >> >>martin >> >-------------------------------------------------------------------------- >Hello Martin, >We have connected the pin 5 of DB9 connector to ground. Also the >properties set for hyperterminal are 9600 baudrate,no parity,1 stopbit,8 >data bits and no flowcontrol.We have connected the pin 13 (R1in) and >14(T1out) of MAX232 to pins 3 and 2 of DB 9 connector respectively.will >there be any problem if we leave the other pins of DB 9 connector? >Expecting a help at the earliest. >Thanks in advance.
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

The 2024 Embedded Online Conference