Thanks for the feedback. By the way, it's not quite "power supply" that you need at pin 4 (MCLR), it's a logic high. You can do that by tying the pin directly to Vdd, but more normally it's done through a resistor (typically 10k), so that you can pull the pin low to reset the PIC if you want to. I don't understand, though, why you needed to make MCLR high after you disabled external reset. Granted, it's not a good idea to leave unused inputs (this pin becomes GP3 when internal reset is used), but it shouldn't have stopped your code working. I wonder if your programmer is setting the config bits correctly? It may be set to override the settings in the code. Or, perhaps it's the other way around - you haven't changed the code, and your programmer isn't applying the config you think you have selected. I don't know about winpic. But in any case, external vs internal clock isn't relevant here - it doesn't affect MCLR in any way. > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On > Behalf Of uaca man > Sent: Friday, 19 June 2009 12:52 PM > To: Microcontroller discussion list - Public. > Subject: Re: [pic] How to make a led flash > > Well I just tried it again with the MCLRDIS instruction and it WORKED, > I > forgot to configure the progammer properly (Winpic). > > David i did read your tutorial and did not understand that i also need > power > supply at the pin 4. > > Thatks everyone again. > > The joy!!! :) > > Beer is on me. > > Cheers, > Uaca > > > > 2009/6/18 David Meiklejohn > > > Strange seeing my own code come back at me - this is from one of my > > tutorials (see my web site). > > > > So to answer some of the points I have seen in this thread: > > > > The 12F629 does not have an ADC, so there are no analog inputs to > turn off. > > In fact, that's why I started the midrange lessons with this part - > there > > is > > less to confuse the beginner, no need to say "clear ANSEL for now and > we'll > > explain why later". > > > > Yes, it is true that the 12F629 does have a comparator. (Funnily > enough, > > that's actually the next lesson I plan to write.) However, the > comparator > > does not in its default state interfere with any outputs. I > recognise > > that, > > when comparator inputs, being used as digital outputs, are read, the > bits > > read as zero and will cause problems due to RMW, even if they are not > > explicitly read. But I have been careful in all of my 12F629 > examples to > > avoid any situation where this is the issue - again to avoid saying > "use > > CMCON = 7 for now, and we'll explain why later". I'll explain about > this > > in > > my next lesson, though. > > > > I believe, as couple have pointed out, that the problem here is a > floating > > MCLR input. The lessons were written for Microchip's low pin count > demo > > board, where MCLR is held high through a 10k resistor (and grounded > by a > > pushbutton, in time honoured fashion). Perhaps I should show this > > explicitly in the circuit diagrams in my tutorials, despite having > > explained > > what MCLR is. Probably worth doing that in a future revision... > > > > The simplest solution here is to enable internal MCLR, by changing > 'MCLREN' > > to 'MCLRDIS'. > > > > > > Regards, > > David Meiklejohn > > www.gooligum.com.au > > > > > > > > > -----Original Message----- > > > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On > > > Behalf Of uaca man > > > Sent: Thursday, 18 June 2009 1:48 PM > > > To: piclist@mit.edu > > > Subject: [pic] How to make a led flash > > > > > > As meny other i'm starting with PICs, i bought some pic 12f629 and > im > > > using > > > 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 4000000 // oscillator frequency for > _delay() > > > > > > // Config: ext reset, no code protect, no brownout detect, no > watchdog, > > > // power-up timer enabled, 4MHz int clock > > > __CONFIG(MCLREN & UNPROTECT & BORDIS & WDTDIS & PWRTEN & INTIO); > > > > > > > > > void main() > > > { > > > unsigned char dcnt; // delay counter > > > > > > // Initialisation > > > TRISIO = ~(1<<1); // configure GP1 (only) as an > output > > > > > > // Main loop > > > for (;;) { > > > // turn on LED on GP1 > > > GPIO1 = 1; > > > > > > // stay on for 200ms > > > __delay_ms(100); > > > __delay_ms(100); > > > > > > // turn off LED on GP1 > > > GPIO1 = 0; > > > > > > // stay off for 800ms > > > for (dcnt = 0; dcnt < 8; dcnt++) { > > > __delay_ms(100); > > > } > > > } // 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 > > > -- > 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