by Peter Schutz
void init_spi_communication ( void )
{
TRISC4 = 1; //SPI Slave In
TRISC5 = 0; //SPI Slave Out
TRISC3 = 1; //SPI Slave CLK In
TRISA5 = 1; //SPI SS Enabled In, used for other purpose then SPI
SMP = 0; //SPI slave mode
SSPEN = 1; //SPI port pins enabled
SSPM0 = 0; //Slave Mode SS pin Disabled
SSPM1 = 0;
SSPM2 = 1;
SSPM3 = 0;
CKP = 1; //Clock idle is high
CKE = 0; //Data on rising edge
}
void main ( void )
{
hardware_init();
initialize ();
init_spi_communication (); // Initialization of SPI
SSPBUF = 0x00; // Clear SPI receive buffer
SSPIE = 1; // Enable interrupt on SPI receiving
PEIE = 1; // Enable peripherial interrupt(For
SPI)
ei(); // Global interrupt enable
asm("sleep"); // Going to sleep
while (1)
;
}
Questions:
Comments:
Hi there!+
It's my first time in PicList!I'm working now on PIC16F687 and I'm looking for some application examples to set up SPI slave mode. I found very helpful information, and I'll be happy to accept further tips about that! Great site! LucaB
| file: /Techref/microchip/language/c/spiinit.htm, 2KB, , updated: 2010/2/20 12:31, local time: 2025/10/24 14:58,
owner: LFMS-HTX-TA1,
216.73.216.22,10-3-83-201:LOG IN
|
| ©2025 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://www.piclist.com/tecHREF/microchip/language/c/spiinit.htm"> SPI communication init</A> |
| Did you find what you needed? |
|
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
|
The Backwoods Guide to Computer Lingo |
.