|
|
View previous topic :: View next topic |
Author |
Message |
ruppe Guest
|
spi problems on 16f819 |
Posted: Sat Apr 16, 2005 4:17 pm |
|
|
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
|
|
Posted: Sat Apr 16, 2005 11:09 pm |
|
|
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
|
|
Posted: Sun Apr 17, 2005 1:40 am |
|
|
Thank you. After deleting the fixed_io it worked. |
|
|
|
|
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
|