# Need help with software config on PIC12F629 to blink LED

I started learning PIC some days ago and have played around with different tutorials. Many of the tutorials I have read, doesn't work for me. I always have to change stuff in the code to make it work, so I actually havn't had any succes yet.

Now I have some code, that SHOULD work (if yiu ask me), but it doesn't. It builds without any errors, byt after burning it, nothing happends. No LED's are blinking or anything.

Could someone please help me figure out why this is not working and maybe explain why. I have read alot of pages on the net, but havn't found anything that could give me a solution, so now I have to ask for help. Thanks

I'm working with a 12F629 and Pickit 1

#include <htc.h>

#define _XTAL_FREQ 4000000     // oscillator frequency
#include <delay.h>           // defines DelayMs()

__CONFIG(FOSC_INTRCIO & WDTE_OFF & CP_OFF & MCLRE_OFF);

void main()
{
// Initialisation
TRISIO = 0b111100;

// Main loop
for (;;) {
GP0 = 1;
GP1 = 1;
__delay_ms(200);
GP0 = 0;
GP1 = 0;
__delay_ms(200);
}
}

• See the example code I gave in this question, it should work fine with the 12F629. Sep 25 '11 at 11:15
• Show the schematic! (We shouldn't have to ask for obvious things like this) Show the actual schematic, don't hand wave in words what you meant to have hooked up to what. Sep 25 '11 at 14:02
• Thanks for helping me out. I already read your answer in the other thread, but nothing worked. I switched the PIc for another and I found out it was my PIC :( It can read and write without errors, but it seems to be bugged somehow. the new one is working great. Sep 25 '11 at 19:18
• Thanks for helping me out. I already read your answer in the other thread, but nothing worked. I switched the PIc for another and I found out it was my PIC :( It can read and write without errors, but it seems to be bugged somehow. the new one is working great. I have another small problem though. The timer is running very unstable even with a capacitor between + and -. I have a LED that should flash twice with 50ms between and then wait 100ms and start over. Like a police flash. But I can see that the timing is off and it's flashing very unstable. Any idear how to fix this? Sep 25 '11 at 19:22
• It would help if you update your question with current code and maybe a schematic or description of your setup. In the meantime, try putting a small delay (e.g. __delay_us(5)) in between the GP0 = 1; and GP1 = 1; (and the GPx = 0; pair too) Or you can set/clear both pins at once with GPIO = 0x03; and GPIO = 0x00; (or use a shadow register) This is to do with read modify write, see here for some info. Sep 25 '11 at 20:36