View previous topic :: View next topic |
Author |
Message |
Ormiga Guest
|
PIC24FJ64GA002 PWM problem |
Posted: Thu Aug 28, 2008 11:40 pm |
|
|
Hi all,
i'm having problem to use the setup_compare function in PCD compiler.
Code: | setup_compare(1, COMPARE_PWM | COMPARE_TIMER2); |
the otuput error say's "invalid parameters to built in function : Invalid Pin"
I also tried with dspic30f4013 and worked fine.
Can anyone help me?
Best Regards |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Aug 29, 2008 12:16 am |
|
|
Hello,
the compiler requires a peripheral pin select to appear in the code anywhere above the statement.
Code: | #pin_select OC1 = PIN_B4
setup_compare(1, COMPARE_PWM | COMPARE_TIMER2);
|
|
|
|
Ormiga Guest
|
|
Posted: Fri Aug 29, 2008 4:53 am |
|
|
Hello Fvm,
I added the code but still not working.
Can you help me again?
best regards |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Fri Aug 29, 2008 4:47 pm |
|
|
What do you mean with not working? Is the error still present or no OC1 operation? I verified with PIC24F, that the error message doesn't appear anymore, when the pin select has been done before. It must fit your device's pin resources, of course. |
|
|
rschoele
Joined: 26 Jul 2007 Posts: 2
|
invalid pre-processor directive invalid pin ID |
Posted: Mon Dec 22, 2008 9:48 pm |
|
|
I found this thread and I'm having the same trouble. I'm new to the PIC24's and I'm using the PIC24FJ64GA002. I have the same code:
Code: |
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(sAN5|VSS_VDD);
setup_timer1(TMR_DISABLED);
#pin_select OC1=PIN_B4
setup_compare(1,COMPARE_PWM|COMPARE_TIMER2);
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);
setup_timer2(TMR_INTERNAL | TMR_DIV_BY_8,10000);
setup_timer4(TMR_DISABLED |TMR_DIV_BY_1 ,0);
setup_timer3(TMR_DISABLED |TMR_DIV_BY_1 ,0);
setup_timer5(TMR_DISABLED |TMR_DIV_BY_1 ,0);
|
and when I compile I get an error: invalid pre-processor directive Invalid Pin ID. Can anyone tell me what it is I'm doing incorrectly?
On a separate note I cannot get the CCS RTOS to work - compiles fine, but doesn't run. I switched timers, etc. If I take the code - simple LED on/off out of the tasks and put it in a while loop it runs fine...
thanks for any help |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Tue Dec 23, 2008 3:42 pm |
|
|
Your code compiles with PCD V4.083 as is. |
|
|
rschoele
Joined: 26 Jul 2007 Posts: 2
|
doesn't compile using CCS as toolsuite in MPLAB |
Posted: Tue Dec 23, 2008 7:41 pm |
|
|
So yes it does compile if I use the CCS PCW IDE and build the code in there.
I have a microchip demo board and ICD, so I'm using the CCS compiler as the selected toolsuite in MPLAB and it doesn't compile in that configuration.
Any thoughts on what could be wrong there? Is there any configurations to set in MPLAB for CCS when migrating to PIC24?
I've installed the latest MPLAB version and reinstalled the CCS MPLAB plug in. I still receive the same invalid pre-processor error.
thanks |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Wed Dec 24, 2008 2:31 am |
|
|
MPLAB has a build options, that may be wrong. A typical log output should look like this:
Executing: "c:\Program Files\PICC\Ccsc.exe" +FD "myproject.c" I+="c:\Program Files\PICC\devices;c:\Program Files\PICC\drivers" +DF +LN -T -A -M -Z +ICD +Y=9 +EA
I remember, that I had to adjust some MPLAB settings, when I started using it with PCD. But I don't know, what had been wrong in detail, cause it's working smoothly since then.
Best regards and Merry Christmas
Frank |
|
|
|