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

SPI on 18F97J60

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



Joined: 09 Feb 2007
Posts: 56

View user's profile Send private message

SPI on 18F97J60
PostPosted: Thu May 28, 2009 7:09 am     Reply with quote

Hello,

Is there any way of getting the two spi channels to work simultaneously on the 18F97J60? I need to read two A/D chips but they need to be read simultaneously.

Thanks
Ttelmah
Guest







PostPosted: Thu May 28, 2009 9:32 am     Reply with quote

Completely simultaneous, no. Close to simultaneous, possibly.
It depends first, on the SPI speed supported by your slave device. On the latter compilers, SPI, supports named streams, just like RS232. The compiler will automatically generate software SPI implementations, if you use pins that do not have SPI hardware. This though is limited in speed, by the number of instructions needed to access the individual bits. You could trigger a hardware transmission, and immediately afterwards start a software transmission, which will take place while the hardware transmission is also occurring. However the maximum speed of this, will be perhaps something like 25 instructions per cycle, while the hardware SPI, will support rates several times faster.
It is also worth realising that in most cases, SPI ADC's, support transferring their data far faster than they can take readings. It is common to be able to read three or four ADC chips on a single SPI bus, in the time it takes the first chip to acquire another reading.
If the readings really do have to be 'smultaneous', you would need to setup the software SPI, in a simulator, and see what the maximum speed it can generate is, then use timer2, to clock the hardware SPI, and program this to match the rate of the software port. This will give you 'close to simulataneous' operation, with just a few instructions 'lag' as the software starts.

Best wishes
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