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

PIC24FJ64GA002 PWM problem

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







PIC24FJ64GA002 PWM problem
PostPosted: Thu Aug 28, 2008 11:40 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 29, 2008 12:16 am     Reply with quote

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







PostPosted: Fri Aug 29, 2008 4:53 am     Reply with quote

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

View user's profile Send private message

PostPosted: Fri Aug 29, 2008 4:47 pm     Reply with quote

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

View user's profile Send private message

invalid pre-processor directive invalid pin ID
PostPosted: Mon Dec 22, 2008 9:48 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Dec 23, 2008 3:42 pm     Reply with quote

Your code compiles with PCD V4.083 as is.
rschoele



Joined: 26 Jul 2007
Posts: 2

View user's profile Send private message

doesn't compile using CCS as toolsuite in MPLAB
PostPosted: Tue Dec 23, 2008 7:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Dec 24, 2008 2:31 am     Reply with quote

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
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