CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

difference between UART hardware devices and others

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ssaakmnt



Joined: 03 Dec 2011
Posts: 27

View user's profile Send private message

difference between UART hardware devices and others
PostPosted: Mon Dec 12, 2011 5:07 am     Reply with quote

hello guys what the difference between the devices that have UART hardware
and other devices that don't for example using serial port with pic16f877 and pic16f84 .
temtronic



Joined: 01 Jul 2010
Posts: 9199
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Dec 12, 2011 6:42 am     Reply with quote

some things...
Those with hardware UARTs allow for better,faster 'standard' serial communications to other computers(usually PCs).Better as the UART is a 'stand alone' peripheral NOT dependent on the PIC for timing or formatting,faster as the UART can issue an interrupt on rcv or xmt of characters,standard means compatible with the 'regular world of 8-n-1 UARTs',less code involved, simple read/writes to the UART registers.

If you do not require that function, then no benefit.For almost 3 decades I've used my own serial communications format over 20 miles of solid copper wire and never had a reason to 'upgrade' to PICs with hardware UART.

Unless you're project requires interfacing to the 'common' computer world,the UART is not needed and a minor cost saving might be possible.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Dec 12, 2011 8:46 am     Reply with quote

Put perhaps more simply,

If you want to do serial on a PIC, with a UART (or some variation) there's hardware built into the chip that does the work for you. If not, your code has to do the work (and is extremely sensitive to timing).

So ask yourself while you're writing code and what to use software UART's, "could my code" or "do I want my code" or "should my code" be doing something else while the code is servicing sending or receiving this serial data?

If the answer is yes, then get a PIC with a hardware UART. While temtronic is right in that they might save a little -- it's usually pennies and in the long run, probably not worth it -- unless you REALLY have that intended app well defined.

Keep in mind at 9600b/s, it takes about 1.04mS to send/recv a char

If you ran a PIC (PIC18 let's say) at 40MHz (Tcy is now 100nS).

You can execute up to 10,400 instructions while that one byte is coming or going. But not so much if you're using software RS232... (unless you do it in interrupts which is still not as nice as having hardware do the work for you)
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Mon Dec 12, 2011 1:31 pm     Reply with quote

Also note that if the PIC is doing work while waiting for a command, such as running a PID loop while waiting for the user to change settings, the PIC must poll the input occasionally so characters are not lost. If you have a hardware UART with a serial interrupt driven buffer you must poll before the interrupt buffer overflows, maybe every 10 or 20 characters. If you have a hardware UART and no interrupts you must poll before the UART buffer overflows, every 2 characters. If you have a software UART and use kbhit() to see if a character is comming in you must poll near the start of the first BIT. That is about every 0.031 characters!

Software UARTs may be OK if the PIC is only talking, or only listens at specific well defined times. If a character can come at any time a hardware UART is almost required.
_________________
The search for better is endless. Instead simply find very good and get the job done.
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Mon Dec 12, 2011 2:19 pm     Reply with quote

I just wrote a GPS app that needs to collect strings -- and keeping in mind the PIC18's have the 8x8 multiplier (again, hardware to the rescue).

I have about 25 "buckets" to hold 10chars each.

I know my GPS spews in bursts and the info I want is < 10chars.

With my current ISR, the PIC can collect strings and just buffer away while the main loop just processes at will. It's more of a "string FIFO" than a "byte FIFO".

Works great... and the keeping the number of strings within the prod output of the hardware 8x8, CCS is smart enough to use is allowing me to index strings inside my ISR efficiently.

the rest of my code does a boadload of sorting and printing to a graphics LCD, so the hardware UART really helps.

Again, the right PIC (and code) for the task is an important consideration.

I'm rambling.

Cheers.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
ssaakmnt



Joined: 03 Dec 2011
Posts: 27

View user's profile Send private message

PostPosted: Tue Dec 13, 2011 2:51 am     Reply with quote

Yes, I think I need a flexible connection like sending and receiving during run time or interrupt a loops and control functions.
I tried to use a typical pic16f84 to send and receive characters and integers to control some functions and loops but I faced lot of problems. I guess now UART hardware may solve it .
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group