I migrate from PIC18F452 to PIC18F4520 ,but when I do a hardware reset (push button in MCLR) the program stop to run,
i need to turn off the power supply and turn on again and the program run normaly.
Any ideas?
This is a single test code
Code:
#include <18F4520.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz)
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV42 //Brownout reset at 4.2V
#FUSES PUT //Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES MCLR //Master Clear pin enabled
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
I need to turn off the power supply and turn on again and the program
run normally.
Make sure you have a pull-up resistor on the MCLR pin.
Use 10K for Microchip ICD2, or 47K for CCS ICDU-40.
Quote:
#FUSES LVP
Change this fuse to NOLVP.
Quote:
setup_vref(VREF_LOW|-2);
The value of -2 is not defined for this function. It's there because
of a bug in the PCWH Wizard. Just delete that line. You don't
need it. The Vref module comes up in a disabled state upon
power-up reset.
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