View previous topic :: View next topic |
Author |
Message |
Guest
|
SPI and RS232 at the same time 18F2455 |
Posted: Mon Sep 07, 2009 5:19 am |
|
|
Hi
Is it possible to use the hardware SPI and RS232 at the same time? Some pin will conflict in hw layout? |
|
|
Guest
|
|
Posted: Mon Sep 07, 2009 9:34 am |
|
|
in 28 and 40 pin families with a full 'C' port pins 6 and 7 are RS-232
and 3,4,5 are SPI
there is NO impediment to using both functions it the same design
Get thee to the data sheets my friend and have a read |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Sep 07, 2009 9:41 am |
|
|
Quote: | RC6/TX/CK
RC7/RX/DT/SDO |
The 18F2455 data sheet shows that RX and SDO are shared pins on this
PIC. |
|
|
Ttelmah Guest
|
|
Posted: Mon Sep 07, 2009 9:54 am |
|
|
Anonymous wrote: | in 28 and 40 pin families with a full 'C' port pins 6 and 7 are RS-232
and 3,4,5 are SPI
there is NO impediment to using both functions it the same design
Get thee to the data sheets my friend and have a read |
No.
On the USB enabled PICs, like this one, unfortunately there is a clash....
It is rather strange actually, in most cases where things like this clash, the manufacturers have fuses that allow you to move the component to other pins, still leaving something clashing, but at least giving you a choice. I suspect the key here is that the RS232 is only seen as likely to be used on a USB PIC, that is emulating a simple UART (and hence not using SPI), and in most cases things that use SPI, are also available in I2C versions (the I2C pins don't clash).
So, choices are find an I2C version of the peripheral involved, or use software SPI.
Best Wishes |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Mon Sep 07, 2009 3:32 pm |
|
|
DUH - apologies - my bad
i did not imagine M'chip would screw the pooch so hard - just to shoe horn USB into the family structure
one way to beat the rap:
USE hardware TX on port C
then
use interrupt handled BIT-bang softwareRS-232 RX on any uncommitted digital B-PORT pin ( since most PIN_Bx pins DO support INTS ) - defining a stream then for TX and RX individually and bonding them in your program
that will free up unhindered hardware SPI
OR
if you don't need full RS-232 capability - i could see how to do it
or if you knew that you would not be using SPI at the same time as RS-232 RX - external 'HC08 gates , an inverter and a free PIC digi pin could make sharing doable - externally - but i've just seen what i will be avoiding that family group
does my ignorance of this bit of info show that i only use RS-232 with the Edgeport family ? |
|
|
|