|
|
View previous topic :: View next topic |
Author |
Message |
nazoa
Joined: 09 Feb 2007 Posts: 56
|
SPI on 18F97J60 |
Posted: Thu May 28, 2009 7:09 am |
|
|
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
|
|
Posted: Thu May 28, 2009 9:32 am |
|
|
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 |
|
|
|
|
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
|