Hi Uaca, How do you have the chip connected externally? Do you have a pull-up on MCLR? It sounds a bit like the classic MCLR floating (unconnected) problem. Sean On Wed, Jun 17, 2009 at 11:47 PM, uaca man wrote: > > As meny other i'm starting with PICs, i bought some pic 12f629 and im usi= ng > some C code exemplas that i found on the net. > > I'm sure it was asked many times before but i can't understand what is > wrong. > > So far i'm able to turn on the led but there is no way to make it flash. > > I'm using the HI-TECH C ide with the PIC10/12/16 MCU family compiler v 9.= 65 > and seems that im cursed, some times the led turns on, some times it just > does nothing until i come close to the PCB and than it turns on just like= a > miracle. > > > The code i'm using: > > #include > > #define _XTAL_FREQ =A04000000 =A0 =A0 // oscillator frequency for _delay() > > // Config: ext reset, no code protect, no brownout detect, no watchdog, > // =A0 =A0 =A0 =A0 power-up timer enabled, 4MHz int clock > __CONFIG(MCLREN & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO); > > > void main() > { > =A0 =A0unsigned char =A0 dcnt; =A0 =A0 =A0 // delay counter > > =A0 =A0// Initialisation > =A0 =A0TRISIO =3D ~(1<<1); =A0 =A0 =A0 =A0 =A0 // configure GP1 (only) as= an output > > =A0 =A0// Main loop > =A0 =A0for (;;) { > =A0 =A0 =A0 =A0// turn on LED on GP1 > =A0 =A0 =A0 =A0GPIO1 =3D 1; > > =A0 =A0 =A0 =A0// stay on for 200ms > =A0 =A0 =A0 =A0__delay_ms(100); > =A0 =A0 =A0 =A0__delay_ms(100); > > =A0 =A0 =A0 =A0// turn off LED on GP1 > =A0 =A0 =A0 =A0GPIO1 =3D 0; > > =A0 =A0 =A0 =A0// stay off for 800ms > =A0 =A0 =A0 =A0for (dcnt =3D 0; dcnt < 8; dcnt++) { > =A0 =A0 =A0 =A0 =A0 =A0__delay_ms(100); > =A0 =A0 =A0 =A0} > =A0 =A0} =A0 // repeat forever > } > > Any ideas on how to find the problem is greatly apreciatted > > Tks > Uaca > -- > 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