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

PSMC configuration

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



Joined: 22 Feb 2017
Posts: 1

View user's profile Send private message

PSMC configuration
PostPosted: Wed Feb 22, 2017 1:03 pm     Reply with quote

I use PSMC for frequency variation. I use 32Mhz clock (8Mhx*4PLL).
Code:

setup_psmc(1, PSMC_VARIABLE_FREQ, PSMC_EVENT_TIME | PSMC_SOURCE_FOSC | PSMC_DIV_8, us(usPeriodo), PSMC_EVENT_TIME, us(100), PSMC_EVENT_TIME, us(350));

In this line I configure PSMC_SOURCE_FOSC, I think it's 32Mhz. If I use PSMC_DIV_8, the frequency is 4Mhz. But the system still behaves as if it were configured at 32Mhz.
Why?
The code is not right?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Feb 22, 2017 2:59 pm     Reply with quote

dragonerd1 wrote:

But the system still behaves as if it were configured at 32Mhz.

And what is that behavior ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19494

View user's profile Send private message

PostPosted: Wed Feb 22, 2017 3:36 pm     Reply with quote

and what chip/compiler version?.
temtronic



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

View user's profile Send private message

PostPosted: Wed Feb 22, 2017 3:42 pm     Reply with quote

Also...does a 1Hz LED program run correctly ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19494

View user's profile Send private message

PostPosted: Thu Feb 23, 2017 3:10 am     Reply with quote

You do realise that if you change the clock being used, you have to change the clock figure in the us define, to get it to do the calculations correctly?.

Code:

#define us(time)  (int16)(time*(getenv("CLOCK")/1000000))


This is assuming that the psmc is fed with the 'clock' (FOSC). To make these calculations work right if using FOSC/8, you have to change this define to match the clock being used.
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