![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
comparing the two SPI methods for 16Fxxx |
Posted: Sun Apr 12, 2009 12:48 pm |
|
|
before starting a project that requires 4 different SPI devices - and 3 different operating modes, that are dynamically switched ( via Not-CS)
on the 16f887 ( with hardware SPI)
sharing the std C port hardware pins for CLK DI DO for all SPI clients
---------
which of the two setup methods is believed more robust for on-the-fly
mode changing operation ??
#USE SPI ....
or
setup_spi() and its intrinsic function allies
are both needed
??
so far i've used #USE SPI with parameters in the header zone of the test program - followed by setup_spi () in the INIT zone
with no problem - with just ONE of the SPI devices-
but no mode changes added to the code so far - with 100% success
on the latest 4.x version of the compiler
Thanks in advance for any informed comments that would illuminate this
better |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Sun Apr 12, 2009 3:15 pm |
|
|
Realistically, I'd use setup_spi.
No, only one is needed. The setup_spi function, is the 'older' route, and is really the better suited for what you are doing, since it puts the timing of the reprogramming of the peripheral completely at your command. With the #use syntax, the code ought to reprogram the peripheral as needed (using multiple streams), but I'd prefer to simply ensure that all the chips are deselected, send the correct setup_spi, which reprograms the chip 'then and there', then enable whichever chip is required, and talk to it. The setup_spi command, actually sends the selected configuration bytes to the peripheral when it is called, and hopefully allows the changes to take place when you expect them, not at some other 'compiler decided' point.....
#use SPI, is the 'required' route, if using software SPI, or if wanting to perform functions not supported by the hardware, adding the extra code to provide these. Setup_spi is the 'simpler' route to use the hardware.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sun Apr 12, 2009 6:06 pm |
|
|
I knew somebody would have a fix on the right answer.
What you said makes perfect sense - .
THANK YOU Mr. 'T' for your scholarly reply. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|