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

Hardware UART

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



Joined: 15 Mar 2008
Posts: 53

View user's profile Send private message

Hardware UART
PostPosted: Tue Mar 25, 2008 6:13 pm     Reply with quote

Can I use #use 232() setup a hardware UART without setup_uart()? Or can I just use setup_uart() without #use 232()? Do I have to use Force_sw for software UART when I use #use 232()? Or does it mean it's hardware UART if I don't use Force_sw in #use232()? My chip is PIC16886.

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Mar 25, 2008 10:31 pm     Reply with quote

Quote:
Can I use #use 232() setup a hardware UART without setup_uart()?

You normally only need setup_uart() if you want to change the baud rate
of the hardware UART at runtime.

Quote:
Or can I just use setup_uart() without #use 232()?

No.

Quote:

Do I have to use Force_sw for software UART when I use #use 232()?

If you are using the hardware UART pins and you want a software UART
on those pins, then you must use FORCE_SW. That's because if you
specify the H/W pins, the compiler assumes you want to use the H/W
UART. If you want to override this, you must use FORCE_SW.

Quote:

Or does it mean it's hardware UART if I don't use Force_sw in #use232()?

If you specify the H/W pins, the compiler will use the hardware UART
by default.


To summarize:
On the H/W UART pins, you may specify a H/W or software UART. The
default is a H/W UART. You may force a S/W UART by using FORCE_SW.

On any other pins, only a software UART is possible. That's all it can do.
boulder



Joined: 15 Mar 2008
Posts: 53

View user's profile Send private message

PostPosted: Tue Mar 25, 2008 10:40 pm     Reply with quote

Thanks. Now my mind is clear about UART setup.
Guest








PostPosted: Wed Mar 26, 2008 3:16 am     Reply with quote

hello, just a concern about FORCE_SW.
It means that both pins will be SW driven, right, and RS-232 SW routines will be added? I dont get it since the RAM and ROM used is still the same as without FORCE_SW.
In other world, what is the difference between using HW UART and SW one?

cheers guys.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Mar 26, 2008 8:21 am     Reply with quote

Quote:

It means that both pins will be SW driven, right, and RS-232 SW routines will be added?

Yes, SW routine must be added.

Quote:

I dont get it since the RAM and ROM used is still the same as without FORCE_SW.

FORCE_SW do not generate code.

Quote:

In other world, what is the difference between using HW UART and SW one?

The main difference is that HW UART generate an interrupt (if it is properly enabled)
in the START bit of the incoming data. While that if a SW UART is used, in order to sense
the START bit it is mandatory to do a polling at a minimum equivalent rate of the period
of one bit, or 10X the expected baud rate.


Humberto
Ttelmah
Guest







PostPosted: Wed Mar 26, 2008 9:04 am     Reply with quote

One thing that may confuse here, is that the routines are not actually generated, till they are _used_. So you can change the #use RS232 line, and compile, and see no difference in the code size. Only is there is a putc, or a getc, _using_ this definition, will the code size actually change.

Best Wishes
Guest








PostPosted: Wed Mar 26, 2008 12:17 pm     Reply with quote

now i see,
cheers
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