View previous topic :: View next topic |
Author |
Message |
ik1wvq
Joined: 21 Feb 2004 Posts: 20
|
PCD problem with "pin_select" of SPI HW |
Posted: Mon Jul 14, 2008 9:57 am |
|
|
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
|
|
|
epotis Guest
|
HW SPI pin assignment |
Posted: Fri Mar 06, 2009 12:25 pm |
|
|
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
|
|
Posted: Fri Mar 06, 2009 5:05 pm |
|
|
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
|
|
Posted: Wed Feb 09, 2011 1:41 am |
|
|
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
|
#pin_select not working |
Posted: Wed Nov 23, 2011 7:42 am |
|
|
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
|
|
Posted: Wed Nov 23, 2011 3:49 pm |
|
|
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
|
#pin_select bug |
Posted: Wed Nov 23, 2011 5:12 pm |
|
|
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
|
Re: #pin_select bug |
Posted: Wed Nov 23, 2011 6:07 pm |
|
|
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
|
COMPILER BUGS |
Posted: Wed Nov 23, 2011 6:23 pm |
|
|
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 |
|
|
|