Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

interfacing the MC serial port

Status
Not open for further replies.

Julia

New Member
Hi guys :)
Actually, I am in a big mess :? and I want someone to help me out
I want to interface a GPS module with Atmel microcontroller ,
The module is used a serial interface, the datasheet of the module notifies me with the following

The serial interface pins, RxD and TxD, are the main signals available for user connection. Aground connection is also required to complete the serial interface. The Module serial port operates under interrupt control. Incoming commands and data are stored in a buffer that is serviced once a second by the receiver's operating program. There is no additional protection or signal conditioning besides the protection designed into the microprocessor since the RxD and TxD pins are connected to the microprocessor directly. TxD and RxD are standard inverted serial signals with 3V voltage swings.
For input signals, minimum input high voltage is 2V and the maximum input high voltage is 3V. Minimum input low voltage is 0 V and the maximum input low voltage is 0.8 V. For output signals, minimum output high voltage is 2.4 V and the maximum output low voltage is 0.5 V.

Now , what should I do to interface this module :roll: , please someone give me an idea about that, and tell me what's the meaning of inverted signals !!!
Can the microcontroller deals with this inverted signals, or shall I invert it first!

 
Usually 'inverted signals' means that it can be connected directly to a micro-controller UART pin - MAX232 type devices invert the data, so the micro-controllers use inverted RS232.

This ONLY applies is you use a hardware UART, if you use a software UART you can make it any polarity you like!.
 
Julia said:
since the RxD and TxD pins are connected to the microprocessor directly. TxD and RxD are standard inverted serial signals with 3V voltage swings.

Use a ATMEL microcontroller that is powered at +3V supply voltage and connect the GPS RxD signal directly to the TxD pin of the microcontroller and GPS TxD to the RxD pin.

i.e. cross the connections on RxD and TxD between the two interface.

With a bit of programming you can communicate with the module. You still have to setup the correct baud rate between the two interface (which involves setting up timers etc... inside the ATMEL chip) and use the correct frequency crystal for the microcontroller in the first place.
 
williB said:
inverted signals , i believe , mean active low..have you got any specs on this device??
these is all the information i gave you, beside the format type = binary, the format direction = in\out, the format baud rate = 9600, the format parity = none, the format data bits = 8, the format start\stop bits = 1/1, that's all !
 
Nigel Goodwin said:
Usually 'inverted signals' means that it can be connected directly to a micro-controller UART pin - MAX232 type devices invert the data, so the micro-controllers use inverted RS232.

This ONLY applies is you use a hardware UART, if you use a software UART you can make it any polarity you like!.

actually , i didn't get you well, but i am using a 89c51 MC, because this is the only MC available here,
so all i got from your words is that i don't need any conversion devices, right ?
 
eblc1388 said:
Julia said:
since the RxD and TxD pins are connected to the microprocessor directly. TxD and RxD are standard inverted serial signals with 3V voltage swings.

Use a ATMEL microcontroller that is powered at +3V supply voltage and connect the GPS RxD signal directly to the TxD pin of the microcontroller and GPS TxD to the RxD pin.

i.e. cross the connections on RxD and TxD between the two interface.

With a bit of programming you can communicate with the module. You still have to setup the correct baud rate between the two interface (which involves setting up timers etc... inside the ATMEL chip) and use the correct frequency crystal for the microcontroller in the first place.
well eblc338 , at first i did think about that, but the problem is i didn't find any atmel works with 3v :cry: , so i use the atmel 89c51 which is powered at +5v . :!:

so, what can i do now ? :roll: :roll: :roll:
 
Julia said:
actually , i didn't get you well, but i am using a 89c51 MC, because this is the only MC available here,

You now have a problem. The min operating supply voltage of AT89C51 is +4V but the max voltage input of your GPS module signal pin is +3V.

You cannot simply connect the interface signals together as the +5V 89C51 signal exceed the max input voltageof the GPS microprocessor.

So you need another interface between the two for 5V<-->3V translation.

I have no idea at the moment of how to translate the level short of using transistors. Perhaps others can help in this respect.

Also Julia, tell us the crystal frequency you are going to use or is available for use. Would it be 11.0592MHz, by any luck?
 
eblc1388 said:
I have no idea at the moment of how to translate the level short of using transistors. Perhaps others can help in this respect.

5V down to three volts can be done with either a two resistor attenuator, or a single resistor - IF the 3V chip has protection diodes on it's input, or you could add external diodes?. The other way, 3V to 5V, you should be able to simply connect the pins directly together - a 5V chip should be able to accept a 3V logic input (PIC's certainly can!).
 
eblc1388 said:
Also Julia, tell us the crystal frequency you are going to use or is available for use. Would it be 11.0592MHz, by any luck?

yes, it's 11.0592 MHz, i used it in order to get the baud rate at 9600 , and i initiallized it well

ORG 0H ; Start at location 0 in the ROM
Mov TMOD, #20H ; Timer 1 Mode 2
Mov TH1, #-3 ; 9600 Baud rate
Mov SCON, # 50 H ; 8-bit, 1 stop bit, REN enabled
SETB TR1 ; Start timer
 
Nigel Goodwin said:
eblc1388 said:
I have no idea at the moment of how to translate the level short of using transistors. Perhaps others can help in this respect.

5V down to three volts can be done with either a two resistor attenuator, or a single resistor - IF the 3V chip has protection diodes on it's input, or you could add external diodes?. The other way, 3V to 5V, you should be able to simply connect the pins directly together - a 5V chip should be able to accept a 3V logic input (PIC's certainly can!).
yeah Nigel, you are right the module has protection diodes on its input ,
now what's better for me to reduce from 5v to 3v, insert a single series resistor or using a series of diodes ?
and what about the other way, i mean from 3v to 5v ?
if i didn't put a buffer in this line i think the 5v of the MC rx pin would damage the module tx pin
 
Julia said:
yeah Nigel, you are right the module has protection diodes on its input ,
now what's better for me to reduce from 5v to 3v, insert a single series resistor or using a series of diodes ?

As long as it's got protection diodes, a single resistor is all that's required, there would be no advantage using anything else. The value shouldn't be at all critical, it just needs to be high enough to limit the current to a low enough value, yet low enough to provide sufficient current for switching. I would suggest something between 22K and 100K should be fine.

and what about the other way, i mean from 3v to 5v ?
if i didn't put a buffer in this line i think the 5v of the MC rx pin would damage the module tx pin

There ISN'T 5V on the input pin! - it's an input, not an output - it should be zero volts at all times, except when an input takes it high!.
 
Hi Julia,

Please wait until others have commented and checked the following circuit. Others might have better solution than this simple design.
 

Attachments

  • 5v3v.gif
    5v3v.gif
    12 KB · Views: 1,076
eblc1388 said:
Hi Julia,

Please wait until others have commented and checked the following circuit. Others might have better solution than this simple design.

'Simple'? - two transistors, three resistors, and a diode, more than required - not what I'd call 'simple' :lol:

Although I did find the use of the blocking diode and pullup resistor quite interesting! - assuming the GPS unit has protection diodes (as he says) totally unnecessary though.
 
at first , i would like to thank you so EBLC , you did a great efforts , i appreciate that, but as Nigel says , this isn't simple beside i can't feel it's right !!

There ISN'T 5V on the input pin! - it's an input, not an output - it should be zero volts at all times, except when an input takes it high!
Nigel, i can swear it's 5v
i measured it by DMM !!
 
Julia said:
at first , i would like to thank you so EBLC , you did a great efforts , i appreciate that, but as Nigel says , this isn't simple beside i can't feel it's right !!

I was going to mirror the bottom circuit for the 89C51 TXD signal also and the circuit would ends up using 4 transistors.

But now it seems there is no point in doing so. :(
 
Julia said:
at first , i would like to thank you so EBLC , you did a great efforts , i appreciate that, but as Nigel says , this isn't simple beside i can't feel it's right !!

There ISN'T 5V on the input pin! - it's an input, not an output - it should be zero volts at all times, except when an input takes it high!
Nigel, i can swear it's 5v
i measured it by DMM !!

If it's a CMOS input pin, not connected to anything, it shouldn't read high, although you shouldn't leave it floating anyway as any slight leakage could pull it high, but the 10 megaohm impedance of the DMM should pull any leakage low.

If it's reading 5V, it sounds like you have it configured as an OUTPUT, and not an INPUT - or, a possibility is that the pin has internal pull-ups, and you have those turned ON (most PIC's have this option on PortB, I don't know about Atmel devices?).

The internal pullups on a PIC wouldn't be a problem (even if they were turned ON), as they are about 600K. But if the input pin is reading 5V, you really need to find out why! - no matter how you do the interfacing!.
 
noone wants to put an end to my inquiries ?
you nigel say the RX pin has to be low! and i had to set it as input port in order to get it low! :?, i was reading about this part in the data sheets and other references, and guess what ? i've found that i can't set the serial ports of AT89C51 because they are already configured, one for TX and the other for RX, and by default the all pins of the MC have to be high :x
so you were wrong when you told me that i have to configure it as input port :evil:
now i am too lost, i began to lose my trust in this forum. :cry: :(
 
Julia said:
noone wants to put an end to my inquiries ?
you nigel say the RX pin has to be low! and i had to set it as input port in order to get it low! :?, i was reading about this part in the data sheets and other references, and guess what ? i've found that i can't set the serial ports of AT89C51 because they are already configured, one for TX and the other for RX, and by default the all pins of the MC have to be high :x
so you were wrong when you told me that i have to configure it as input port :evil:
now i am too lost, i began to lose my trust in this forum. :cry: :(
The thing is Nigel and I don't know ATMELs at all. Nigel was just trying to tell you what he would do with PIC If he had such problem. :roll:
 
The thing is Nigel and I don't know ATMELs at all. Nigel was just trying to tell you what he would do with PIC If he had such problem. Rolling Eyes
SO ? noone can help me in this forum ?! no one how to deal with AT89C51 ?
:cry: :cry: :cry: :cry: :cry: :cry: :cry:
i will fill this forum with my tears
:cry: :cry: :cry: :cry: :cry: :cry: :cry:
:wink:
 
Status
Not open for further replies.

Latest threads

Back
Top