PIC UART. how is it any good ?

Status
Not open for further replies.

pkshima

Member
If I read , I see that to be able to attach my PIC (16F628) to my computer, I still have to circuit in a MAX232. On top of that I(actually Nigel did it for us already) have to code up the RS232 protocol.

So I am thinking wtf is the UART claimed to be in the PIC good for ?

sorry for noob question. Perhaps the UART definition doesnt cover 5<->12v conversion and the RS232 protocol. So what is it supposed to mean ?
 

The UART does the serial transmission and reception in hardware, if you want RS232 you still need a MAX232 or some other level shifter and inverter. The advantage of using the UART is that it's fast and takes hardly any processor time, and can even be interrupt driven - the disadvantage is that you need an inverter for RS232, and that it uses fixed pins. The software method means you can use pretty well any pins, and don't require an inverter (you can invert in software) which means you can use a simple resistor for a crude RS232.
 
Sorry for high jacking Pradeep‘s thread I also have a question to ask.

Actually what’s the meaning of USART & UART?
I know it stands for, but I don’t know the meaning.

Then what is RS232 communication? is it same?
 
Look up UART and USART on wikipidia, they have more info then anyone should give here. Also lookup software uart aka bit banging.

Nigel said:
The UART does the serial transmission and reception in hardware, if you want RS232 you still need a MAX232 or some other level shifter and inverter.

I think that should be "level shifter or inverter".

What Nigel is saying is that the UART/USART sends and recieves data (0s and 1s) using the voltage defined by the logic family it is implemented in. For TTL compatiable logic this would be +5V for 1 and 0V for ground.

RS232 defines the logic levels to be -12V and +12V. This is done to allow the singnals to travel further without degrading. For even greater distance you can use other specs like RS422. You can convert a UART signal to either of these using the correct level shifter. For RS232 we now use a single chip like the MAX232. In the past we used to used on chip to send and another to recieve.

In some cases you can do without the MAX232 and fake a level shifter using resistors. Buy you still have to invert the TTL level signal either in hardware or software.

HTH
 
hi,
I think if you look around you will find that most, if not all freestanding UART's require additional hardware for level shifting
and inversion, if they are to meet the RS232 serial protocol standard.

They also require coding within any program for correct initailising and operation, so they are no different from the UART within a PIC.

Even the UART in your PC has level shifting and inversion.
 
3v0 said:
I think that should be "level shifter or inverter".

No, it needs to do BOTH - using a software UART you can use just a single resistor (check the BASIC STAMP), because you can invert it in the software, you can't do this with the hardware UART though.
 
I am still confused

Isnt Nigels code sending/receiving data a bit at a time handling the time to wait between each bit ? If so, MAX232 plus the software is doing everything. What is the uart doing ?

It can be done using any pins ? why only the UART pins ?
 
pkshima said:
I am still confused

Isnt Nigels code sending/receiving data a bit at a time handling the time to wait between each bit ? If so, MAX232 plus the software is doing everything. What is the uart doing ?

The UART isn't used on the earlier tutorials, ONLY on the last one. The software UART routines do all the timing in the software, the final hardware UART tutorial uses the UART hardware to do it all.

It can be done using any pins ? why only the UART pins ?

If you use the hardware UART you have to use the pins allocated to it, if you use a software UART you can choose which pins you want.
 
That you can be asking these questions reveals a complete lack of understanding or appreciation. I recommend that you go back to the datasheets and read them very carefully. If you do, you will note the lack of shift registers and control logic in the MAX232 family of chips. If you read the section of the PIC data sheet that talks about the UART, you will notice a complete lack of circuits which deal with converting logic level signals to RS-232 levels. You cannot be so bovine as to think that a UART and a MAX232 chip perform the same function.
 
Thanks Nigel, I will go read the hardware UART tutorial. hopefully i will get the right mental context to read the datasheet then.

Papabravo : thanks for visiting my thread.
 
All the RS232 level shifters I know of invert the signal.
You do not need a level shifter AND an inverter.
 
3v0 said:
All the RS232 level shifters I know of invert the signal.
You do not need a level shifter AND an inverter.

You don't need two seperate devices, you need one that does BOTH though (like a MAX232), but BOTH functions are required. As long as you stick to hardware UART's and MAX232's you don't need to know about it, but if you're using software UART's or non-MAX232 methods, then it's something you have to be VERY aware of.
 
Maxim classify them as level shifters with inversion.

Extract from MAX d/s
 
Last edited:
Nigel Goodwin said:
if you want RS232 you still need a MAX232 or some other level shifter and inverter.

Honestly I do understand RS232. I just reread the above, I had misinterpreted what you said. AND is right with a non inverting level shifter.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…