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.

Rs-232-c

Status
Not open for further replies.

YAN-1

New Member
Hello everyone. I was reading the datasheet of an electronic compass that I intend to purchase and I was trying to make sure whether I can interface to it through the UART module of my 16F877A. In the datasheet of the compass, it says that it has 2 forms of obtainig UART communication. The first one has RC and TX pins with voltage levels of 0V for logic 0 and 3.3V for logic 1. For the other pair of pins, it says 'Fully Compliant with RS-232-C Standard'. Which one of these should I connect to the RC and TX pins of my 16F877A PIC? Will I be needing a MAX232 converter, and doesn't the PIC module follow the normal 0V/5V TTL?

Thanks a lot. Your help is much appreciated.

Nichola V. Abdo
 
hi yan
>> For the other pair of pins, it says 'Fully Compliant with RS-232-C Standard'. Which one of these should I connect to the RC and TX pins of my 16F877A PIC? Will I be needing a MAX232 converter, and doesn't the PIC module follow the normal 0V/5V TTL?

You will require a MAX232 connected to 16F877 PIC's TX/RX pins.

The PIC /TX and /RX are TTL levels which are compatible with the MAX232,
which will translate the signals to the RS232 standard, suitable for connection to a PC's serial port.
 
Yeah but can't I connect the PIC directly to the 0/3.3V option of the compass?
 
>> The first one has RC and TX pins with voltage levels of 0V for logic 0 and 3.3V for logic 1.

From memory the 16F877 Vdd is specified as +5V, if will work at Vdd=3.3v I have never tried. Check the data sheet.

Also the 'sense' of the /TX and /RX maybe not be the same as the compass, does it say, can you post the compass datasheet?
 
Personally I would consider using pins with TTL buffers on PORTB - for example - and software UART. The treshold voltages are 0.8 V (low level) and 2 V (high level) with Vdd = 5 V.
 
Last edited:
There you go. Please check it out and let me know what you think.
 

Attachments

  • SP3003D.pdf
    609.8 KB · Views: 779
hi,
As the datasheet says the logic levels for the SPI interface are fixed at 3.3V
as are the internal UART levels, however the RS232 lines are standard.

So with a MAX232 on your PIC /TX and /RX inputs is a simple connection.

If you can find a PIC that will operate at Vdd = 3.3V and has a SPI interface you could chose that method.

I would recommend a standard RS232 interface with a MAX232.

To help to write and debug your NEMA protocols you could always connect your compass via the RS232 to a PC.

Is this OK?
 
3.3 volt output logic will interface with 5 volt input logic nicely. As eng1 said the threshold voltage is around 2 volts. But 5 volt to 3.3 volts logic isn't as easy, some 3.3 volt chips are 5 volt tollerant, some are not, a simple voltage divider can make the down conversion.
 
I see. Thanks a lot. I think I will use the MAX and connect the PIC directly to the RS232 pins of the compass. And when I need to connect the compass directly to the PC for resting, I don't need a MAX, right? And on another matter, how does the MAX generate the 12 or 15 volts for the RS232 standard from the 5V supply? Thanks.
 
One thing more..
MAX232 is also invert it's out put.
If it's input is low it will give u High output..
Keep this in mind.
 
The datasheet states that the UART:URXD0 and UART:UTXD0 are non inverted 3.3V logic levels and should interface with a pic directly without a MAX232. You would of course still need a voltage divider on TXD if you are operating on 5V, however, the supply can be upto 20V.

Mike.
 
hi yan,
The MAX232 has internal switchers, which together with 4 external capacitors will generate the +/- Volts required for the RS232 connection, the MAX voltages are about +/-9Volts.

What will be the distance between the Compass and PIC pcb??
With a RS232 link you could have a distance of around 30mtr, using a screened cable.

I dont know the application for your Compass, can you tell us???

I designed and manufactured a electronic compass for marine survey applications, it is called 'POLARIS'.
The siting of the Compass unit is important, thats one reason I am suggesting the RS232 method, also you be able to interface the Compass unit directly to a PC's serial port for debugging and test.
 
So sorry for the late reply. Well I intend to use the compass to determine the orientation of a car in an unmanned ground vehicle i'm working on. Basically, it'll be mounted on a moving car so I'm worried about the vibrations. I'm not sure yet about the distance from the PIC pcb, but it shouldn't be that far. Any advice? Thanks a lot.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top