|
|
View previous topic :: View next topic |
Author |
Message |
scaven92
Joined: 06 Oct 2006 Posts: 44
|
PIC18F14K22 Sampling Rate SPI to UART |
Posted: Thu Aug 27, 2009 2:31 pm |
|
|
Hello,
I have an SPI signal coming to my PIC with at above 8kHz. Will a PIC18F14K22 be able to read this and pass it out the UART in time? This is with a 16MHz external clock with a 4x PLL.
1/8000kHz = 125us between each sample
Don't know how many instructions in between at the moment as I havn't written any code yet.
1/(16*4MHz) = 15.6ns / instruction
It seems to me it would be easy for it to keep up and possibly buffer the signal. What do you think, am I logical?
Thanks for the help!
-Chris |
|
|
Ttelmah Guest
|
|
Posted: Thu Aug 27, 2009 2:49 pm |
|
|
First your instruction time is wrong. PIC instructions take four clock cycles/instruction. So at 16Mhz, with a *4 PLL, you get 16MIPS, 62.5nSec/instruction.
However you could do what you so far describe, at a clock rate probably 1000 times slower than this. SPI, is handled in hardware, it takes no more than perhaps half a dozen instructions to test the status bit, and read a byte. Similarly the UART is in hardware, and sending data takes no more than transferring a byte to the output register.
Whether you can actually do it, depends _totally_ on what processing you have to perform, what amount of data is generated on the serial for each received byte, and what speed you can run the serial link (hardware limits).
Best Wishes |
|
|
scaven92
Joined: 06 Oct 2006 Posts: 44
|
|
Posted: Thu Aug 27, 2009 4:18 pm |
|
|
Ttelmah,
Thanks for the correction. I won't have much overhead between reads from SPI and writes to UART. I'll start working on it.
Thanks again!
-Chris |
|
|
|
|
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
|