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

PIC 18F6722 I/O SPI

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



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 15, 2006 11:30 am     Reply with quote

I found the code for the Kagan article. It's at this ftp site:
ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/2002/145/
This is the full code for the "Driving the NKK SmartSwitch" pdf article.

This runs on a PSOC chip, which is not a PIC. It looks like he's
using hardware SPI. This is his first line in the MAIN.C file:
Code:

SPIM_1_Start(SPIM_MODE_2 | SPIM_LSB_FIRST);

He's using SPI master mode 2, and he's set it up to transmit the LSB
first. Of course, the PIC's SPI module transmits a byte "MSB first",
so a quick way of reversing the bit order within a byte by a software
algorithm must be used. Here are some threads with several methods:
http://www.ccsinfo.com/forum/viewtopic.php?t=23356
http://www.ccsinfo.com/forum/viewtopic.php?t=23364
http://forum.microchip.com/tm.aspx?m=50138

The timing should be checked with a logic analyzer. Here's a relatively
cheap one that runs on a PC (via a USB port), that we use:
http://www.pctestinstruments.com/
KamPutty
Guest







PostPosted: Tue Aug 15, 2006 3:53 pm     Reply with quote

pdswar wrote:
rwyoung, thank you very much for the info.

I was wondering if anyone here has any sample code that creates
firmware driven SPI port using general I/O pins in PIC 18F6722.

Thank you for your time.


Hi all,
I just pasted some of my spi code (pic18f4520 --> OLED) here:
http://forum.sparkfun.com/viewtopic.php?t=3808&start=15
It includes the bitbanging routines, 5x7 fonts, test code, etc...
Hope it helps...

~Kam (^8*
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