please dont rip this site

PIC Microcontoller Input / Output Methods

for SPI

Tony Kübek, Flintab AB says:

According to the data for the F876, regarding the SPI module I paraphrase ( DS30292-A page 66 ):
" - SDI is automatically controlled by the SPI module "

Then after the table it states:

"Any serial port function that is not desired may be overridden by programming the ....TRIS register to the opposite value"

I just spent 3 hour tracking down the obvious bug of setting the SDI as an output ( as I only read the first paragraph ). Is it only me ( I'm not native English ) but aren't these statements actually wrong ? ( they opposite each other ).

Anyway, if anyone cares here the lesson: ALWAYS ( exept UART TX/RX ;-) ) set the pin they way you will use it, i.e. outputs ( ex. SDO ) should have TRIS bit cleared, inputs ( ex. SDI ) should have TRIS bit set.

Galen O'Grady askes

I am using a 16C63 as an SPI slave (with SS* enabled). When doing multi-byte transfers, does the SS* pin need to be cycled (by the master) after each byte, or can it remain low for the entire transfer?

David Kott [dkott at TESTPROD.COM] answers:

No. You do not need to cycle it between each byte transfer. To wit, to test this notion, setup your SPI in slave mode with SS control enabled, and ground the SS line. The SPI will function identically, provided you are transferring 8 bits per word (as you implied when you described the data as a "byte")

Recently, I was having an issue with my SPI Slave code. I had SS control enabled. However, it seems that the device sourcing the SS signal was not conforming to the timing requirements for the PIC. Merely grounding the SS line allowed the SPI subsystem to function properly. Subsequently, I configured my SPI to not use SS control.

The PICmicro Mid-Range MCU Family manual says this:

"When the SPI is in Slave Mode with SS pin control enabled, (SSPCON<3:0> = 0100) the SPI module will reset if the SS pin is set to VDD. If the SPI is used in Slave Mode with the CKE bit is set, then the SS pin control must be enabled. When the SPI module resets, the bit counter is forced to 0. This can be done by either by forcing the SS pin to a high level or clearing the SSPEN bit..." (c) Microchip Technology Inc.

Sample 16F876 code with SPI master setup as well as RS232, etc... by Tony Kübek

SPI interface to AD7730 by Tony Kübek

SPI Slave for PIC 16c73 by Josef Hanzal, M. S.

SPI to MAX7221 LED Driver by Marcel Birthelmer

cover"Serial PIC'n : PIC Microcontroller Serial Communications" by David Benson

General SPI (not PIC specific)

Questions:

See also:

Archive:

Comments:


file: /Techref/microchip/spi.htm, 10KB, , updated: 2008/12/30 19:20, local time: 2017/8/22 03:53,
TOP NEW HELP FIND: 
54.159.71.232:LOG IN

 ©2017 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?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF="http://massmind.org/techref/microchip/spi.htm"> PIC SPI</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .