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

setup_spi error; maybe a bug?

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








setup_spi error; maybe a bug?
PostPosted: Sat Jan 24, 2009 7:31 am     Reply with quote

Hi

Is the setup_spi doing the right thing?
(PIC 18xx2455 PCW 4.083)

If using PortB.1 as input it wont work because the tris is set to output?
Maybe a compiler bug?

The setup_spi can work without the tris setting.

Code:
setup_spi(SPI_SS_DISABLED);

0B22:  BCF    SSPCON1.SSPEN
0B24:  BCF    TRISC.7
0B26:  BSF    TRISB.0
0B28:  BCF    TRISB.1
0B2A:  MOVLW  01
0B2C:  MOVWF  SSPCON1
0B2E:  MOVLW  00
0B30:  MOVWF  SSPSTAT
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jan 24, 2009 1:04 pm     Reply with quote

You're keeping the SPI module active, but only disabling Slave Select.
To completely disable it and have it not touch the TRIS, do it like this.
Code:
.................... setup_spi(FALSE); 
0018:  CLRF   SSPCON1
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