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

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



Joined: 10 Oct 2004
Posts: 21
Location: UK

View user's profile Send private message Yahoo Messenger MSN Messenger

SPI 18f4455
PostPosted: Wed Jun 29, 2005 2:49 am     Reply with quote

Hello can anyone help with the problem im having :

Iwish to use the spi port as a shift regester to send 8bits of data in 8 clock cycles from D0 so that i dont have to waste the cycles shifting the data myself any ideas anyone?
Ttelmah
Guest







PostPosted: Wed Jun 29, 2005 3:12 am     Reply with quote

It might help if you said what the 'problem' is!.
The SPI port, _is_ a shift register. If you setup the SPI, with something like:
setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_4);

Then use SPI_WRITE(0x55);

You will get the byte output on the SDO pin, with the clock used on the SCL pin.

The fastest clock available, is the oscillator/4 (same as a single instruction time). Data is sent MSB first, and you can change to 'SPI_H_TO_L' to clock it on the other edge if required.

Best Wishes
mjdale2003



Joined: 10 Oct 2004
Posts: 21
Location: UK

View user's profile Send private message Yahoo Messenger MSN Messenger

PostPosted: Thu Jul 07, 2005 9:21 am     Reply with quote

Hi, thanks for the input but it seems that i still cant get it to work, the aplication is not actualy conected to anything i just wish to use the spi as a shift regester so i dont have to do it in software and to save instructions
Ttelmah
Guest







PostPosted: Thu Jul 07, 2005 2:22 pm     Reply with quote

So describe your problem.
The most likely things to stop it working, are an incorrectly set TRIS register (if you are controlling this yourself), an old compiler version (there were some problems here a while ago), or some other peripheral interfering with the setup (remember the hardware I2C uses the same pins).
It will just shift the data out.

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