My guess would be that somehow the configuration options for the PIC18 aren't right when you burn the normal code -- did you set all the options explicitly in your code?

When you run from MPLAB + ICD2, configuration options are part of the project and they get downloaded, etc. But when you program a bare device, you need to ensure that the configuration words (at a high address) are also in the HEX file, etc. You can see them pretty easily by examining the hex file ...

I’m using PICC18 8.35 PL3 + salvo 3.2.3 + mplab 7.2. Recently I’m making a project about embedded TCP/IP.When I run the program in debug mode,everything works perfectly, also I check the ICD option in picc18 compile options. But when I burn this code in programmer mode(of course uncheck icd option in compiler options), program goes crazy. doesn’t work properly without debug mode. I can’t understand this weird problem. Anyone has an idea to solve this?