View previous topic :: View next topic |
Author |
Message |
ds
Joined: 01 Nov 2009 Posts: 15
|
Software Serial Similar to Arduino |
Posted: Wed Mar 24, 2010 5:57 pm |
|
|
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
|
Re: Software Serial Similar to Arduino |
Posted: Wed Mar 24, 2010 6:15 pm |
|
|
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
|
|
Posted: Wed Mar 24, 2010 6:18 pm |
|
|
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
|
|
Posted: Wed Mar 24, 2010 7:04 pm |
|
|
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
|
|
Posted: Wed Mar 24, 2010 7:43 pm |
|
|
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 |
|
|
|