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

How much UART can define CCS?

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



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

How much UART can define CCS?
PostPosted: Thu Jun 11, 2020 3:32 pm     Reply with quote

Normally I use 2 uart by hardware and 2 uart by software ( using int0,int1,int2, or int_RB). but I want know if CCS let me make 6 UART?

Like this:

TX0, RX0 (hardware)
TX1, RX1 (hardware)
TX2( any pin), RX2 (ext_int0)
TX3( any pin), RX3 (ext_int1)
TX4( any pin), RX4 (ext_int2)
TX5( any pin), RX5 (any PIN of int_RB4-8)

Thanks you.
temtronic



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

View user's profile Send private message

PostPosted: Thu Jun 11, 2020 3:42 pm     Reply with quote

Quick comment...
You can have as many hardware UARTS as a PIC has, and several software UARTS. The problem is all software UARTS are 'bitbanged', so timing is critical.
I have an old compiler so I don't know if CCS has changed the compiler to allow what you post. Others will know for sure.
So if you need lots of UARTS with ultra fast response( IE: interrupt driven) you'll need external peripheral UARTS. At one time (yes, when the dinosaurs roamed...) you could by a 'quad UART'. Perhaps someone makes such a device today ??
cvargcal



Joined: 17 Feb 2015
Posts: 134

View user's profile Send private message

PostPosted: Thu Jun 11, 2020 4:48 pm     Reply with quote

temtronic wrote:
quick comment...
You can have as many hardware UARTS as a PIC has, and several software UARTS. The problem is all software UARTS are 'bitbanged', so timing is critical.
I have an old compiler so I don't know if CCS has changed the compiler to allow what you post. Others will know for sure..
So if you need lots of UARTS with ultra fast response( IE: interrupt driven) you'll need external peripheral UARTS. At one time(yes, when the dinosaurs roamed...) you could by a 'quad UART'. Perhaps someone makes such a device today ??


Thank you for the answer.
I need make a device with 3 uart (GPRS, WIFI, Debug) but i need 2 uart more for 2 sensors that use serial port.
Maybe is not complex the timing response... so that is the reason i need know if ccs let.
temtronic



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

View user's profile Send private message

PostPosted: Thu Jun 11, 2020 5:08 pm     Reply with quote

Ok, I went to Microchip's website > parametris search > chose 8 bit PICs > seelcted 5 UARTS....
magically about 10 or so are shown !
They're probably faifly new devices, so check to see if your versaion of the compiler will work for them.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Jun 11, 2020 11:56 pm     Reply with quote

and, yes CCS happily lets you run with these. I'd suspect there will be a limit
somewhere, but have yet to hit it. Have a project running at the moment with
the PIC24FJ512GB610, have 6 hardware serials all running merrily.

Be aware with what you show, that once the code is receiving a character
on one of the software ports, it won't be able to receive on any of the
others, till this character is complete. Also, receiving characters will
interfere with transmission.
Generally, unless characters are very infrequent, this is not going to
be a reliable way to work.
So CCS will allow you to set this up, but _using_ it, is not likely to be
really practical... Sad
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 12, 2020 6:14 am     Reply with quote

Related to above: There's a line in the ccs manual for kbhit().
For reliable operation in software UART, you must poll kbhit() with at least ten times the frequency of your baud rate. Otherwise you will miss incoming characters.
temtronic



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

View user's profile Send private message

PostPosted: Fri Jun 12, 2020 6:48 am     Reply with quote

I got curious... found this..
https://www.maximintegrated.com/en/products/interface/controllers-expanders/MAX14830.html

there's probably more available, about $10US makes me think a PIC with HW UARTS would be cheaper, easier and smaller.

One 'trick' using software UARTS is to reduce baudrate. Microchip had an 'application note' very early (25 years ago)... about making a mouse using a PIC. While in assembler it had very,very clever coding like checking switch statuses(sp) while bitbanging data to the PC.

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Jun 12, 2020 7:06 am     Reply with quote

He doesn't have to poll, since he is using hardware interrupts to trigger
the actual start of the getc. However the issue remains that once a
character starts receiving, the code will be stuck in the interrupt handler
for the whole duration of the character. If another arrives on any of
the other ports while this is happening, it will be missed.... Sad
I'm assuming this since his notes in each case mention an interrupt
for each of the RX lines.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Jun 12, 2020 7:10 am     Reply with quote

As a comment, the Maxim IC, is 3* the price of the PIC with 6 UARTs.....
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