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 on 16F690 - Wizard bug

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



Joined: 27 Jun 2007
Posts: 206

View user's profile Send private message

SPI on 16F690 - Wizard bug
PostPosted: Thu May 21, 2009 4:35 pm     Reply with quote

Hi!

I have a question and an answer. I use PCWHD v 4.084.
With the PICWizard I have created new project and in the project I'm using SPI communication. To this point everything is OK. But when I configured everything like it should be, I got this code:

Code:

#use delay(clock=8000000)
#define SPI_CLK   PIN_C3
#define SPI_DI   PIN_C4
#define SPI_DO   PIN_C5


void setup()
{

   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_OFF);
   setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_DIV_4);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);


In the wizard I selected the option to name the ports .... and one very strange thing happened. Pins that were defined as SPI pins were wrong according to the PIC datasheet.
So I was confused and I simply write the code to constantly send some bytes to the SPI and measured with the scope on the pins.
Result was, that datasheet is correct and CCS actually sends data and clock using correct pins. Wizard defines wrong pins. Rolling Eyes

So for anybody who will be doing same on this combination .... the correct pins are:
Code:
#define SPI_CLK   PIN_B6
#define SPI_DI   PIN_B4
#define SPI_DO   PIN_C7
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri May 22, 2009 11:52 am     Reply with quote

one of many reasons to use the data sheet and forget the wiz
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