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 CCS Technical Support

Software UART Questions

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



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Software UART Questions
PostPosted: Tue Aug 28, 2007 2:13 pm     Reply with quote

3.249
18LF4620
3.3V


Hello All,

I'm having to resort to a software UART to receive for the first time. I had originally planned on a timer/poller receive scheme but haven't had much luck. I just did some searching and reading and I have some questions....

I've mod'd the board to tie RX to B4. I plan to use INT on Change (however, I could use B0-2 for EXT INT if better suited?) What's the better choice?

It appears as though I just put the standard character receive routine in the PortB interrupt? I may have different INTs on other pins, so I'll just qualify which pin is generating the INT and handle it that way.

Is there a good rule about the speed available on a software UART based upon processor speed?

Any other suggestions?

Thanks,

John
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Tue Aug 28, 2007 3:23 pm     Reply with quote

I think I've found most of what I was looking for:

EXT interrupts are better suited because they allow you to interrupt on only one pin. Using a PortB INT requires that you isolate which pin caused the INT.

Would like to get 14,400 using a 40MHz clock, but it sounds as if that may be iffy.



John
Humberto



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

View user's profile Send private message

PostPosted: Tue Aug 28, 2007 4:23 pm     Reply with quote

Hi John,

In this forum there are examples codes that will be useful for you, search
using the word "STREAM".


Humberto
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 28, 2007 5:09 pm     Reply with quote

Take time to consider you requirements. Do you really need full-duplex or will half duplex suffice? Is it allowed for the software UART to be blocking or do you need background processing (interrupt driven)?

Half duplex is much easier then full duplex. Interrupt driven code can work in the background but is more difficult than a blocking function.
The CCS compiler generated UART is a blocking half duplex driver.

As a performance reference: My project uses a full duplex interrupt driven 19200 baud software UART routine on a 16MHz PIC18F458. Running at 40MHz this might just be capable of reaching the 56kbaud. It is an assembly routine using high priority interrupts. Sorry, I can't give you the code as it is not my design. I modified the code from the book "Serial PIC'n" version 2.0 by Roger L. Stevens (www.sq-1.com).

Andrew (asmallri) is selling code for several software uarts: http://www.brushelectronics.com/index.php?page=software#SWUART
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