I'm running win 10, microC Pro 6.6.2, mikroprog suite 2.32. The code is very simple
Code: Select all
void setup() {
ANSELA = 0; // set digtal no analogues
ANSELB = 0; // set digtal no analogues
ANSELC = 0; // set digtal no analogues
TRISA = 0; // set direction to be output
TRISB = 0; // set direction to be output
TRISC = 0; // set direction to be output
TRISE = 0; // set direction to be output
// Set up the oscilator module
OSCCON = 0b01110011; // bits 6:4 are IRCF - clock frequency
// bits 1:0 are SCS - system clock source
OSCCON2 = 0b00000000; // bit 4 is MFIOSEL
OSCTUNE = 0b11000000; // bit 6 is PLLEN
// bit 2 of OSCCON will show if Hi freq osc is stable 1=stable 0 = not stable
// bit 7 of OSCCON2 will show system clock comes from PLL = 1 or not =0
} // end of setup()
void main() {
setup();
do {
LATA = 0x00; // Turn OFF LEDs on PORTA
LATB = OSCCON;
LATC = OSCCON2;
Delay_ms(1000); // delay
LATA = 0xFF; // Turn ON LEDs on PORTA
Delay_ms(1000); // delay
} while(1); // Endless loop
}
SW1 are all off, SW2 are all off, SW3 are all ON, SW4 are all off. J19 is set for MCLR. Button press level J17 set to VCC and J24 is not in place. For all ports (A-E) the Pull up/down are all in the off position. The programmer progresses to the verify action. It then stall randomly and the DATA led of the ICD blinks once every few seconds and halts.
If I select external crystal as the oscillator choice then I enjoy 100% success rate (VCAP set for RA4 RA5). And yes such simple code works.
I ask myself what am I missing? Is it something in the Config fuses?
Hoping one of you kind folk might be able to shed light on the situation.
Thanks,
Mike