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 problems on 16f819

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







spi problems on 16f819
PostPosted: Sat Apr 16, 2005 4:17 pm     Reply with quote

is there anybody who has hardware spi working on the 16f819?
I actually can't see anything happen on the RB1, 2, and 4 pins.
Any known issues?

#fuses NOWDT,INTRC_IO, NOPUT, NOBROWNOUT, NOLVP, NODEBUG, PROTECT

#use fixed_io( b_outputs=PIN_B0, PIN_B5)

setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_CLK_DIV_4);

Thanks,
ruppe
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Apr 16, 2005 11:09 pm     Reply with quote

Quote:
is there anybody who has hardware spi working on the 16f819 ?
I actually can't see anything happen on the RB1, 2, and 4 pins.

#use fixed_io( b_outputs=PIN_B0, PIN_B5)

Your fixed_io() statement is preventing SPI from working.
The 16F819 data sheet lists how the i/o should be configured
for SPI. Your line doesn't conform to the data sheet:
Quote:

• SDI must have TRISB<1> set
• SDO must have TRISB<2> cleared
• SCK (Master mode) must have TRISB<4> cleared
• SCK (Slave mode) must have TRISB<4> set
• SS must have TRISB<5> set

But in fact, the CCS setup_spi() function takes care of all this for you.
You don't need to set the tris on the SPI pins with code or a fixed_io()
statement.

If you still can't make it work after removing that line, then post your
version of the compiler, and I'll check if setup_spi() is working OK in
your version.
ruppe
Guest







PostPosted: Sun Apr 17, 2005 1:40 am     Reply with quote

Thank you. After deleting the fixed_io it worked.
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