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

18F45K50

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



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

18F45K50
PostPosted: Tue May 19, 2015 10:17 am     Reply with quote

Hi all

I try to use a 18F45K50 but I have a strange problem.


Code:
#include <18F45K50.h>
#fuses   INTRC       // Internal RC Osc

void main() {
setup_oscillator(OSC_4MHZ|OSC_INTRC);
output_high(PIN_B5);
}


When I build in debug mode the output goes up.
When I build in release mode the output is not working.

Thanks in advance for your help.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue May 19, 2015 7:24 pm     Reply with quote

Do you have a pull-up resistor on your MCLR pin ? This will be a 10K
resistor if you use Microchip ICD3, or 47K if you use CCS ICD-U64.
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Wed May 20, 2015 5:44 am     Reply with quote

yes The hardware is good

Finally it works with adding

Code:
#fuses  NOICPRT      // ICPRT disabled


but I don't understand why I need to disable it.
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed May 20, 2015 7:05 am     Reply with quote

Read the data sheet....
Code:

3: Available only on 44-pin TQFP package devices. Program this bit clear on all other devices.


It _must_ be disabled on 'all other devices'.....
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Wed May 20, 2015 7:21 am     Reply with quote

I use 44 pin TQFP
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Wed May 20, 2015 7:40 am     Reply with quote

If so, setting the fuse, enables this feature, but then the resistor must be present on the clock line to bias this 'off' or the chip won't run, except with a debugger connected.....
in_nursery



Joined: 25 Oct 2012
Posts: 51

View user's profile Send private message

PostPosted: Wed May 20, 2015 8:37 am     Reply with quote

ok 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