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

what happens with this pin?

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



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

what happens with this pin?
PostPosted: Tue May 24, 2005 4:00 am     Reply with quote

Hi,

review this piece of code:

Code:
#define BR_STROBE PIN_C4

main()
{
output_low(BR_SLEEP);
setup_spi (SPI_MASTER|SPI_L_TO_H|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4);

...

}


What has happened with pin C4 ( = SDI of the SPI peripheral). I want to use it as an spi-independant I/O. -or I only want to use the master interface of the SPI.

edit:

How can you disable the SPI in CCS-C ?
valemike
Guest







PostPosted: Tue May 24, 2005 5:22 am     Reply with quote

Assuming RC4 is part of the SPI MSSP module, then your setup_spi module will override any tris settings you have for the tris bits.

You'll have to choose another pin for io.
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Tue May 24, 2005 6:11 am     Reply with quote

what if I switch those statements?


Code:
setup_spi (SPI_MASTER|SPI_L_TO_H|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4);
output_low(BR_SLEEP);
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue May 24, 2005 6:20 am     Reply with quote

What if you read the datasheet for the PIC?
Christophe



Joined: 10 May 2005
Posts: 323
Location: Belgium

View user's profile Send private message

PostPosted: Tue May 24, 2005 8:04 am     Reply with quote

Quote:
Any serial port function that is not desired may be
overridden by programming the corresponding data
direction (TRIS) register to the opposite value.


I'm sorry that I was for any inconvenience for you, Mark
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Tue May 24, 2005 11:09 am     Reply with quote

Didn't inconvenience me Smile I was just helping you to help yourself.
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