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 CCS Technical Support

PCD problem with "pin_select" of SPI HW

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



Joined: 21 Feb 2004
Posts: 20

View user's profile Send private message

PCD problem with "pin_select" of SPI HW
PostPosted: Mon Jul 14, 2008 9:57 am     Reply with quote

Hi,

I noticed a problem with SPI "pin_select" ...
Code:

#include <33FJ12GP202.h>
#type unsigned

#Fuses WRTB,NOBSS,NOPROTECT
#Fuses NOWRT,PR_PLL,XT,CKSFSM
#Fuses NOOSCIO,NOWDT,NOWINDIS,WPRES128
#Fuses PUT128
#Fuses NOIOL1WAY,NODEBUG,NOCOE
#Fuses NOJTAG

#pin_select SDI1=PIN_B13   // ** THIS LINE FALLS IN ERROR ! **
#pin_select SDO1=PIN_B14
#pin_select SCK1OUT=PIN_B12

#use spi(SPI1, MASTER, BITS=8, stream=SPI_STREAM)
#use delay(clock=80000000, restart_wdt)

The error is:
Quote:
"Invalid Pre-Processor directive Invalid Pin ID" on line "#pin_select SDI1=PIN_B13"

The compiler is PCD 4.076D limited.

Can you help me ??

Thanks in advance

Mauro ik1wvq
Storic



Joined: 03 Dec 2005
Posts: 182
Location: Australia SA

View user's profile Send private message Send e-mail

PostPosted: Mon Jul 14, 2008 4:02 pm     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=31639&start=90
_________________
What has been learnt if you make the same mistake? Wink
epotis
Guest







HW SPI pin assignment
PostPosted: Fri Mar 06, 2009 12:25 pm     Reply with quote

I 've got the same problem with 4.084 with a 24FJ256110
Anyone found a solution yet or do I still need to contact CCS staff?
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Fri Mar 06, 2009 5:05 pm     Reply with quote

If it's a valid setting, but doesn't work with #pin_select statement for some reason, you can write the respective setting to peripheral pin select registers.
E-logic



Joined: 09 Feb 2011
Posts: 1

View user's profile Send private message

PostPosted: Wed Feb 09, 2011 1:41 am     Reply with quote

I had got the same problem with 4.099 with a 24FJ64GA002. But I found a solution about it. #pin_select directive doesn't recognize TAB code.

#pin_select<TAB>U1TX=PIN_B8
You get "Invalid Pre-Processor directive Invalid Pin ID" error.

#pin_select<Space>U1TX=PIN_B8
The BUILD will succeed.

Regards.
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

#pin_select not working
PostPosted: Wed Nov 23, 2011 7:42 am     Reply with quote

I think that this error occurs as there is no pin_selecting available for SPI1, but only for SPI2(in my case, that is PIC18F26J11).

But, even for SPI2, #pin_select is not working at all(in my case). I´m using CCS C compiler PCH version 1.107.

I´m trying making pin_selecting directly programming registers. I think that it is a non-portable(not C good pratic) workaround.

Thanks =D
_________________
Eduardo Guilherme Brandt
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Wed Nov 23, 2011 3:49 pm     Reply with quote

E-logic wrote:
I had got the same problem with 4.099 with a 24FJ64GA002. But I found a solution about it. #pin_select directive doesn't recognize TAB code.

#pin_select<TAB>U1TX=PIN_B8
You get "Invalid Pre-Processor directive Invalid Pin ID" error.

#pin_select<Space>U1TX=PIN_B8
The BUILD will succeed.



This is an old bug that keeps coming and going... it was solved a while back, recently introduced and I think solved again in one of the most recent updates. (I'd have to verify though)
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

#pin_select bug
PostPosted: Wed Nov 23, 2011 5:12 pm     Reply with quote

Dear bkamen.

I discover something today (I didn't know) that is necessary to change the TRIS register of the selected pin, even if the selected peripheral not claim for it (ex. SPI2). It seems to be a little different of setting a peripheral with native pins configuration, isn't it?

I noticed also that in version V4.107 (PIC18F26J11) the problem not is with pin_select, but yes it is in spi_xfer() function.


Please, I have had found a lot of CCS PCH and PCD bugs. Have another compilers so many bugs like CCS?
By the other side, I love CCS C drivers and resources.

Thanks for any opinion!
_________________
Eduardo Guilherme Brandt
bkamen



Joined: 07 Jan 2004
Posts: 1615
Location: Central Illinois, USA

View user's profile Send private message

Re: #pin_select bug
PostPosted: Wed Nov 23, 2011 6:07 pm     Reply with quote

Eduardo__ wrote:
Dear bkamen.

I discover something today(I dindn´t know) that is necessary to change the TRIS register of the selected pin, even if the selected peripheral not claim for it(ex. SPI2). It seems to be a little different of setting a peripheral with native pins configuration, isn´t it?

I noticed also that in version V4.107(PIC18F26J11) the problem not is with pin_select, but yes it is in spi_xfer() function.


Please, I have had found a lot of CCS PCH and PCD bugs. Have another compilers so many bugs like CCS?
By the other side, I love CCS C drivers and resources.



I'm not sure what you're saying but let me reply with this:

When in doubt, I always set the TRIS register for the peripherals I want to use to make sure that INPUTs are INPUTs and OUTPUTs are OUTPUTs.

So.

With your next question:

Are other compilers as buggy as CCS? Well.. all compilers have their bugs.

CCS attempts to write a compiler that's really optimized for PIC micro's and when you compare what they do for you (i.e. ISR routines and the global interrupt handler) vs what YOU have to write when in C18 (like I'm working on something now) -- C18 makes YOU do a LOT more work to accomplish something. Thus, the compiler supports less built-in features. So it might seem to have less bugs.

is that a good thing? Well.... that's up to the user to decide. I can proto things in CCS a lot faster than in C18 simply because C18 requires me to write more to accomplish the same thing.

So it's really true that "your mileage may vary" -- because it does... project to project.
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
Eduardo__



Joined: 23 Nov 2011
Posts: 197
Location: Brazil

View user's profile Send private message

COMPILER BUGS
PostPosted: Wed Nov 23, 2011 6:23 pm     Reply with quote

Thank you, I´m very pleased with your answer.


I had never used another PIC C compiler, but they seem to have less features. Thanks for information about C18.

You´re right: The developer have to choose what is better.
Thanks.
_________________
Eduardo Guilherme Brandt
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