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.

USART,I2C,RS232 confusion

Status
Not open for further replies.

andy257

Member
Hi All,

Trying to take the next step in learning the PIC microcontroller and am now looking into the various ways of sending data. What i dont understand is how to decide which method to use as they seem to be very similar.

I understand I2C is used when communicating between two IC's (pic and external eeprom etc) The confusion comes with usart and rs232. I know rs232 is a popular standard for communicating with computers but does that involve a usart?

Also i was looking into using an LCD board. How is the best way to go about sending data to one. Do i need a usart?

can anyone correct me or explain things better.

Thank You

Andy
 
andy257 said:
Hi All,

Trying to take the next step in learning the PIC microcontroller and am now looking into the various ways of sending data. What i dont understand is how to decide which method to use as they seem to be very similar.

I understand I2C is used when communicating between two IC's (pic and external eeprom etc)

I2C is basically designed for TV sets, to simplify their PCB design, it allows information to be sent between the various chips in the set using just a single pair of wires - as such it's fairly slow, but it has no need to be fast.

The confusion comes with usart and rs232. I know rs232 is a popular standard for communicating with computers but does that involve a usart?

USART means 'Universal Syncronous Asyncronous Receiver Transmitter', a PC only has a UART (no Syncronous part), and generally that's all that's required. A UART can be either hardware (like a PC and many PIC's have) or simply written in software.

Also i was looking into using an LCD board. How is the best way to go about sending data to one. Do i need a usart?

No you don't need a USART for LCD, it's a parallel interface.

can anyone correct me or explain things better.

Check my tutorials for details of how to do both LCD and RS232 (and I2C for that matter).
 
Hi Nigel,

Thanks for the comments.

Just a few more questions if you dont mind. I am looking at your tutorials as we speak.

are USART and rs232 are one in the same? / used in conjuction with one another?

Cheers

Andy
 
wow Nigel gave i2c a bad rap there! :)

Maybe it started out being for tv sets (Philips does make a lot of tv's), but it's more than that today.

i2c or inter-integerated circuit is a fast and reliable synchronous board-level communication protocol

i2c is "slow" compared to the microwire or SPI bus, but it is "fast" compared to rs-232

typically running at 100khz as its slowest speed, i2c goes all the way up to 1mhz, and recently the spec was extended for speeds beyond 1mhz

I'd say the most common thing I use i2c for in my hobbies is talking to eeprom, real-time clocks and led controllers. One cool thing you can do with i2c is called 'multi master'. If you're working on a project that needs a couple different micro controllers (a robot for example), they can share a high speed i2c bus, letting them talk to each other, as well as share access to components like ultrasound sensors, eeproms, motor controllers, etc.
 
On the subject of I2C if one wanted to use it to connect an extra eeprom chip or something to a pic how do you configure it? Is it an extra dedicated chip? or is it an onboard pic thing

Andy
 
andy257 said:
are USART and rs232 are one in the same? / used in conjuction with one another?

RS232, if I'm not mistaken, is a physical standard, not a protocol. That is voltage levels and connectors, and the timing requirements of the other lines, CTS, DTE etc... The format of the data actually sent along an RS232 channel isn't part of RS232, but it almost always a typical asynchronous UART format. That is start bit, data, (parity) stop bit. With typical baud's of 2400 - 115200 bits/s.

So in answer to your question. They are 'used in conjunction with one another'.

I2C, as nigel perfectly explained is just to reduce the need for lots of PCB traces between communicating IC's, its addressable so multiple devices can be connected to the master with the same two wires. SPI is similar in that its synchronous (has a clock line) but there is no adressing, just a 'chip select' line for each device..can go up to 20Mhz. U(S)ART comms is generally async, two lines can give full duplex comms at a fairly slow bitrate, but it is simple and easy to setup so its still used today.

Blueeeth
 
andy257 said:
On the subject of I2C if one wanted to use it to connect an extra eeprom chip or something to a pic how do you configure it? Is it an extra dedicated chip? or is it an onboard pic thing

Andy

it's an extra chip ... dedicated perhaps in the sense all it does is eeprom, but not dedicated in that multiple processors could access it
 
andy257 said:
On the subject of I2C if one wanted to use it to connect an extra eeprom chip or something to a pic how do you configure it? Is it an extra dedicated chip? or is it an onboard pic thing

Andy

Not entirely sure what you mean, the PIC doesn't have a dedicated means of specifically controlling of-board memory (like avr's do with RAM) but if the eeprom is I2C compatable, and the PIC has an onboard SPI/I2c peripheral, that would handle the hardware for you. You would just need to write a routine that sends the memroy address to the eeprom, and return the data from it. Plenty of examples on the web.

Blueteeth
 
Blueteeth said:
RS232, if I'm not mistaken, is a physical standard, not a protocol. That is voltage levels and connectors, and the timing requirements of the other lines, CTS, DTE etc... The format of the data actually sent along an RS232 channel isn't part of RS232, but it almost always a typical asynchronous UART format. That is start bit, data, (parity) stop bit. With typical baud's of 2400 - 115200 bits/s.

So in answer to your question. They are 'used in conjunction with one another'.

I2C, as nigel perfectly explained is just to reduce the need for lots of PCB traces between communicating IC's, its addressable so multiple devices can be connected to the master with the same two wires. SPI is similar in that its synchronous (has a clock line) but there is no adressing, just a 'chip select' line for each device..can go up to 20Mhz. U(S)ART comms is generally async, two lines can give full duplex comms at a fairly slow bitrate, but it is simple and easy to setup so its still used today.

Blueeeth

With RS232 am i right in saying it is just the hardware configuration (voltage levels (+/-12V) and connectors (25 way or 9 way D type) that make it rs232. The protocol is any serial bit transmission e.g using a usart? correct?

Cheers

Andy
 
andy257 said:
With RS232 am i right in saying it is just the hardware configuration (voltage levels (+/-12V) and connectors (25 way or 9 way D type) that make it rs232. The protocol is any serial bit transmission e.g using a usart? correct?

That's probably the easiest way to understand it.

As for my comments on I2C, it was correct - Philips invented I2C specifically for inter-IC communication in TV sets. Obviously it's spread rather wider than that now, and has become a standard interface between many chips - simply to reduce the PCB layouts.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top