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

24FJ128GA704 PWM w/o using a timer?
Goto page Previous  1, 2
 
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: 537
Location: Des Moines, Iowa, USA

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

PostPosted: Thu Mar 12, 2020 11:26 am     Reply with quote

gaugeguy wrote:
When you have several different 'lettered' outputs, look at the CCP_PULSE_STEERING_x to determine which output it gets directed to.
Refer to the processor .h file


Ah. Was my issue here that there were TWO CCP2s and this the #use couldn’t tell which one?
_________________
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 ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Mar 12, 2020 12:29 pm     Reply with quote

The #USE PWM, is a powerful tool, but comes at a very large cost. It
removes direct control of what resources are actually used. The timing
controls produce bulky code, and you are having to 'guess' what
resources are actually use.
If prototyping and I want a frequency quickly, I'll use #USE, but as soon
as I want to use explicit resources I'll switch to controlling things myself.
This way I can assign the resources and know what hardware is used.
It's a 'shortcut', but equivalent to one that takes you straight across
a bog....
allenhuffman



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

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

PostPosted: Fri Mar 13, 2020 8:11 am     Reply with quote

Ttelmah wrote:
The #USE PWM, is a powerful tool, but comes at a very large cost. It
removes direct control of what resources are actually used. The timing
controls produce bulky code, and you are having to 'guess' what
resources are actually use.
If prototyping and I want a frequency quickly, I'll use #USE, but as soon
as I want to use explicit resources I'll switch to controlling things myself.
This way I can assign the resources and know what hardware is used.
It's a 'shortcut', but equivalent to one that takes you straight across
a bog....


Thanks -- good to know. I was experimenting with it this morning and that left me with more questions than answers.

I do like that it calculates everything for me (prescaler).

I have successfully used PWM on our speaker to play music, and hardware is going to swap two pins for me so I can test that on the backlight.

I am now trying to move the other two timers to just Timer 1. We need a 32-bit counter for hardware being added to the board, soon.
_________________
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 ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Fri Mar 13, 2020 8:51 am     Reply with quote

Remember 'input capture' can again support using it's own internal
counters.
allenhuffman



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

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

PostPosted: Wed Mar 18, 2020 10:47 am     Reply with quote

Ttelmah wrote:
Remember 'input capture' can again support using it's own internal
counters.


Is there an example of this somewhere?
_________________
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 ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Thu Mar 19, 2020 1:10 am     Reply with quote

On the setup_capture, just use 'CAPTURE_SYSTEM_CLOCK'. This then
makes the capture unit clock from the system clock using it's own internal
counter.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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