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

Software Serial Similar to Arduino

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



Joined: 01 Nov 2009
Posts: 15

View user's profile Send private message

Software Serial Similar to Arduino
PostPosted: Wed Mar 24, 2010 5:57 pm     Reply with quote

Hi there,
I was wondering if there are any drivers or methods to efficiently create a software serial on a PIC similar to the one the Arduino is capable of:

http://www.arduino.cc/en/Tutorial/SoftwareSerial

This would allow me to use more than just one serial device on a PIC. I could potentially communicate to a computer and comunicate to another pic via the same chip! Or is there another method to implement more than on serial device on a single PIC chip?

Thanks all!

DS
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

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

Re: Software Serial Similar to Arduino
PostPosted: Wed Mar 24, 2010 6:15 pm     Reply with quote

ds wrote:
Hi there,
I was wondering if there are any drivers or methods to efficiently create a software serial on a PIC similar to the one the Arduino is capable of:

http://www.arduino.cc/en/Tutorial/SoftwareSerial

This would allow me to use more than just one serial device on a PIC. I could potentially communicate to a computer and comunicate to another pic via the same chip! Or is there another method to implement more than on serial device on a single PIC chip?

Thanks all!

DS


Sure, since you are using the CCS compiler just look up "#use rs232" in the compiler's documentation. That will tell you how to setup software serial. You can set the RX and TX pins and all that good stuff.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 24, 2010 6:18 pm     Reply with quote

That code doesn't look like anything special. It doesn't use interrupts.
It uses software timing loops. CCS can do that. Just specify two
ordinary i/o pins in your #use rs232() statement. CCS will create a
software UART on those pins.
robomaniac



Joined: 16 Jul 2009
Posts: 19
Location: Sherbrooke, Québec, Canada

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

PostPosted: Wed Mar 24, 2010 7:04 pm     Reply with quote

Code:
#use rs232(baud=9600,rcv=PIN_C7,xmit=PIN_C6)


In that case PIN_C7 and C6 are the real serial hardware pins. Choose the one you want.
_________________
Jérôme Demers
www.jeromedemers.com
ds



Joined: 01 Nov 2009
Posts: 15

View user's profile Send private message

PostPosted: Wed Mar 24, 2010 7:43 pm     Reply with quote

Wow thanks so much guys!
This is another reason I want to try to stick with CCS vs go towards Arduino.
CCS has such a great database of information, especially on this forum! Arduino definitely has this support as well, but the end product with CCS and a PIC for some reason seems a little more professional.

Anyways!
Thanks all!

DS
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