View previous topic :: View next topic |
Author |
Message |
in_nursery
Joined: 25 Oct 2012 Posts: 51
|
18F45K50 |
Posted: Tue May 19, 2015 10:17 am |
|
|
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
|
|
Posted: Tue May 19, 2015 7:24 pm |
|
|
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
|
|
Posted: Wed May 20, 2015 5:44 am |
|
|
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
|
|
Posted: Wed May 20, 2015 7:05 am |
|
|
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
|
|
Posted: Wed May 20, 2015 7:21 am |
|
|
I use 44 pin TQFP |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19499
|
|
Posted: Wed May 20, 2015 7:40 am |
|
|
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
|
|
Posted: Wed May 20, 2015 8:37 am |
|
|
ok thanks |
|
|
|