but i cant get it to program in.... I'v switched it from debug to RELEASE then selected PICKIT2 from the programmer, and reset the software and pickit connection, everything is saying ok to go, power on, mclr off, but im not getting any thing flashing on the uC, is there something else im missing?
maybe linker and header are different in release mode?
none of the leds are lighting, usually they at least flikker a bit even while initializing, but now nothing, and in debug mode everything is now perfected
As you don't get an error message then I'm assuming that it has programmed correctly and it is a bug in your code. I suggest debugging the old way. At the start of your code set one of the LED pins to output and turn the LED on. Follow that line with a while(1);. If the LED lights then it is programming ok. Gradually move the code down until you identify where the code stops. Then work out why.
BTW, a quick look at your code shows that you enable interrupts before you setup the chip, a sure way to get a random crash.
void main (void)
{
trise=0 //e2 output
while (1) {latebits.late2 = 1}
}
is just a quick example, the code debugs ok, but when i go in to program mode & release, port e2 wont switch on, I also took the liberty of taking the hex that mplab compiled and loaded it manually in to pickit programmer, to which i got an unusual error " too many words, or undefined words" or to that sort. Mind that when i use the programmer in mplab no errors return. and device reads target as properly loaded.
USING GCGB importing hex to the pickit would always say "hex file is larger than device" but the programs have always seem to run regardless.
A couple of things to check,
Are you using PK2 in program mode not debug?
Are you selecting release mode?
Is MCLR tied to Vdd?
Are you releasing from reset?