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

Enabling CLKOUT

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



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

Enabling CLKOUT
PostPosted: Thu Aug 11, 2022 9:56 am     Reply with quote

I'm using a PIC16F1823 and v5.109 of the PCWHD compiler. I am trying enable the CLKOUT feature that will output Fosc/4. I setup the pic as:
Code:

#FUSES WDT            //Watch Dog Timer
#FUSES INTRC_IO       //Internal RC Osc
#FUSES NOPROTECT      //Code not protected from reading
#FUSES BROWNOUT       //Reset when brownout detected
#FUSES MCLR           //Master Clear pin enabled
#FUSES NOCPD          //No EE protection
#FUSES PUT            //Power Up Timer
#FUSES CLKOUT

//Set Clock speed
#use delay(internal=8MHZ,RESTART_WDT)

When I build the code, the list file indicates that CLKCOUT is disabled:
Code:

Configuration Fuses:
   Word  1: 3FDC   INTRC_IO WDT PUT MCLR NOPROTECT NOCPD BROWNOUT NOCLKOUT IESO FCMEN
   Word  2: 1EFF   NOWRT PLL_SW STVREN BORV19 NODEBUG NOLVP

According to the data sheet, the only FOSC configurations that don't support this mode are LP, XT, and HS.
What am I missing?
Ttelmah



Joined: 11 Mar 2010
Posts: 19509

View user's profile Send private message

PostPosted: Thu Aug 11, 2022 10:31 am     Reply with quote

Code:

//Set Clock speed
#use delay(internal=8MHZ,RESTART_WDT)

#FUSES WDT            //Watch Dog Timer
#FUSES INTRC_IO       //Internal RC Osc
#FUSES NOPROTECT      //Code not protected from reading
#FUSES BROWNOUT       //Reset when brownout detected
#FUSES MCLR           //Master Clear pin enabled
#FUSES NOCPD          //No EE protection
#FUSES PUT            //Power Up Timer
#FUSES CLKOUT


Or:

Code:

#FUSES WDT            //Watch Dog Timer
#FUSES INTRC_IO       //Internal RC Osc
#FUSES NOPROTECT      //Code not protected from reading
#FUSES BROWNOUT       //Reset when brownout detected
#FUSES MCLR           //Master Clear pin enabled
#FUSES NOCPD          //No EE protection
#FUSES PUT            //Power Up Timer

//Set Clock speed
#use delay(internal=8MHZ,RESTART_WDT, CLOCK_OUT)


The point is that the oscillator setting in #use delay, always defaults
to turning off clock out. The fuse is therefore being overridden by this.
So you either have to put the fuse after the use delay statement, or
tell this to enable the clock out.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Aug 11, 2022 10:34 am     Reply with quote

One more thing: ensure that if that particular processor has slew rate control/limiting, that it is turned off for that pin. It defaults to on.

Spent many hours trying to figure out why I couldn't see the clkout signal myself once, and the culprit was the slew rate control for that pin.
SeeCwriter



Joined: 18 Nov 2013
Posts: 160

View user's profile Send private message

PostPosted: Thu Aug 11, 2022 12:53 pm     Reply with quote

Your suggestions worked. Thanks.
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