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

fast clock SPI

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



Joined: 08 Mar 2008
Posts: 6

View user's profile Send private message

fast clock SPI
PostPosted: Sun Aug 24, 2008 4:36 pm     Reply with quote

Hi folks, I apologise if this topic has been covered already but I didn't have luck finding a related post and I am new to picc.

Is it possible to read a 16 bit sync serial signal that gets updated at 16kHz ? Can I use spi_read( )? If so, could someone please point me in the right direction with the code.

Many thanks

Juan
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 24, 2008 7:24 pm     Reply with quote

If you want help, tell us the manufacturer and part number of the SPI
device that provides the 16-bit data. Also post a link to the data sheet
for the device.
microJuan



Joined: 08 Mar 2008
Posts: 6

View user's profile Send private message

PostPosted: Mon Aug 25, 2008 1:09 am     Reply with quote

Hi,

the device datasheet can be found in www.finger-kg.de/lieferprogramm/micrometer/tastende_laser/doku/files/SLS7000Manfi.pdf

Figure 220 on page 22 shows the data output format. I have used two max485's (in receiver mode) one for the data signal and the other for clock signal. The outputs of these max485 comes up nicely on a CRO. I can see the clock signal as well the data signal.

Any suggestions as to how I can read this signal would be of great help.

Many thanks

Juan
Ttelmah
Guest







PostPosted: Mon Aug 25, 2008 10:02 am     Reply with quote

Yes, you should be able to receive this with the SPI hardware.
The bit order is right for SPI.
You would need to run the PIC as slave, with CKP=0, and CKE=0.
I can't see any real problems, except possibly needing to implement a 'synchronise' routine. I'd suggest that on the PIC waking, or if the checksum fails, you disable the SPI hardware, and sit monitoring the clock line. You look for a gap in the clock, longer than the 1/16000th of a second between bits, and when this is seen, restart the SPI. This way, you will be synchronised to the clock from the device, and regain sync, if it gets lost.

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