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

Hardware SPI [solved]

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



Joined: 06 Jul 2011
Posts: 3

View user's profile Send private message

Hardware SPI [solved]
PostPosted: Wed Jul 06, 2011 7:36 am     Reply with quote

I use a 18F26J50 with SPI interface to a 23K256 Serial SRAM
Compiler version 4.114

I want to use the hardware SPI and want to remap the output pins:
Code:

#pin_select  SDI2=PIN_B0
#pin_select SDO2=PIN_B3
#pin_select SCK2=PIN_B2
#USE SPI (MASTER, SPI2, MODE=0, BITS=8, STREAM=SPI_23K256, MSB_FIRST)

I can see that that the SFR RPINR21(SDI2) is set to 3 as expected.
The RPOR5 is not set to 10(SCK2) and RPOR6 is not set to 9(SDO2) as expected, and the SPI2 hardware do not work.

If I use software SPI:
Code:

#use SPI( MASTER,DI=PIN_B0, DO=PIN_B3, CLK=PIN_B2, STREAM=SPI_23K256,SAMPLE_RISE, BITS=8).

The communication with the 23K256 works fine.

What can the problem be ?
SH



Joined: 06 Jul 2011
Posts: 3

View user's profile Send private message

Re: Hardware SPI
PostPosted: Sat Jul 16, 2011 7:27 am     Reply with quote

SH wrote:


What can the problem be ?


I have solved the problem:

set_tris_b(0b11110001);

Now Hardware SPI works.
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