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 CCS Technical Support

PIC18F14K22 Sampling Rate SPI to UART

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



Joined: 06 Oct 2006
Posts: 44

View user's profile Send private message

PIC18F14K22 Sampling Rate SPI to UART
PostPosted: Thu Aug 27, 2009 2:31 pm     Reply with quote

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







PostPosted: Thu Aug 27, 2009 2:49 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Aug 27, 2009 4:18 pm     Reply with quote

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