For now I can't do that -- no crystals where I'm at, and this board is =20 not setup for a crystal anyway. It's a custom board I was using to =20 develop another app. Cheers, -Neil. Quoting Andre Abelian : > Neil, > > just to test add external crystal and turn off internal also turn =20 > off brawn out > reset. > see what happens. > > AA > > > > > ________________________________ > From: PICdude > To: piclist@MIT.EDU > Sent: Mon, June 6, 2011 8:52:55 AM > Subject: [PIC] C issue > > Decided to (finally) tinker with C programming this weekend, and using > the default install of Hi-Tech C (Lite) that came with MPLAB 8.66. > > I created a basic piece of code to turn on some LED's (multiplexed > discrete and 7-segment) on an existing board I have, and it takes a > LONG time to start up -- in the order of several minutes, if at all. > One a couple occasions it worked right away. So I'm guessing the > oscillator is not starting up properly...? > > I also tried setting the config bits from the Config Bits menu rather > than the code and it worked (code ran immediately on programming) the > first time, but I can't reproduce that any more. > > Also tried explicitly turning on Vdd and releasing from reset, but no > difference. And the board works perfectly with assembly code. > > What am I missing here? For reference, this is the code I'm using =20 > (16F883)... > > > > #include > > __CONFIG(1, FOSC_INTRC_NOCLKOUT & DEBUG_OFF & WDTE_OFF & LVP_OFF & > BOR_ON & CP_OFF & CPD_OFF & FCMEN_ON & IESO_ON & MCLRE_OFF & PWRTE_ON); > __CONFIG(2, BOR4V_BOR40V & WRT_OFF); > > #define FOSC 8000000L /* 8 Mhz internal clock */ > > void main(void) > { > INTCON =3D 0; > > OSCCON =3D 0x71; /* 8 Mhz internal clock */ > > TRISA =3D 0b00001011; > TRISB =3D 0b11100000; > TRISC =3D 0b00000000; /* PORTC is all outputs */ > > ANSEL =3D 0b00000011; /* RA0,1 are analog inputs */ > ANSELH =3D 0; > ADCON1 =3D 0b00010000; /* Left justified, External Vref+ */ > > OPTION_REG =3D 0; /* Port-B pullups active */ > WPUB =3D 0b01100000; > > VRCON =3D 0; /* Turn off */ > T1CON =3D 0; > CM1CON0 =3D 0; > CM2CON0 =3D 0; > CM2CON0 =3D 0x02; /* Turn off comparators */ > > PORTA =3D 0b11111111; /* Turn on all columns */ > PORTB =3D 0b11111111; /* Turn on all rows */ > PORTC =3D 0b10101010; /* Turn on all rows */ > > /* TODO -- testing... just stop here for now */ > for (;;) > { > } > } > > > Cheers, > -Neil. > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .