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

5.093: Compiler error with two CCP PWMs

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



Joined: 17 Jun 2019
Posts: 552
Location: Des Moines, Iowa, USA

View user's profile Send private message Visit poster's website

5.093: Compiler error with two CCP PWMs
PostPosted: Wed Mar 18, 2020 10:52 am     Reply with quote

Due to the "garbage" in the error output, I suspect this is a bug and have already contacted CCS for advice, but thought I'd ask here...

Has anyone used two of the CCPs to generate PWM on a pin? I have this:

Code:
#PIN_SELECT CCP2OUTA=BEEPER_PIN
#use pwm(CCP2, FREQUENCY=4000, DUTY=50, PWM_OFF, STREAM=BEEPER_PWM)


...which works. And I have this:

Code:
#PIN_SELECT CCP3OUTA=BACKLIGHT_PIN
#use pwm(CCP3, FREQUENCY=4000, DUTY=100, PWM_OFF, STREAM=BACKLIGHT_PWM)


...which also works. But, I can't build when both of them enabled. I get this:


Quote:
*** Error 99 Line 152(8,75): Option invalid PWM PIN_‰15 already used


I am also unclear on how PIN_SELECT works when both are on the same CCPx. i.e., CCP2OUTA / CCP2OUTB, but there is only CCPx as a parameter for the #use PWM.
_________________
Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
temtronic



Joined: 01 Jul 2010
Posts: 9229
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Mar 18, 2020 11:04 am     Reply with quote

Someone who knows will chime in soon,here's my wild idea...

Code/compile/print the listing for the 2 versions.
See which registers get setup, look at datasheet to confirm.

You should (may) be able to cut a third program and 'hard code' the registers the way you want IF possible.

Jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 18, 2020 1:37 pm     Reply with quote

Look at the post from kda406 near the end of this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=57604
He was able to make it compile by adding the "output=[pin]" parameter
to each #use pwm() statement.
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