PDA

View Full Version : 12F629 help



willie
- 26th January 2006, 00:54
I have wired up a 12f629 to flash some LEDs on the GP0 and GP1 pins and I also use a 4 Mhz Xtal on GP4 and GP5.

The code I wrote is

loop:
high GPIO.0
pause 750
low GPIO.0
pause 750
high GPIO.1
pause 750
low GPIO.1
pause 750
goto loop
end

But when I power it up it dose nothing.

Can someone help.

Willie

Peter1960
- 26th January 2006, 03:33
Dont forget to set the analogue ports to digital.
I believe it to be cmon = 7

mister_e
- 26th January 2006, 03:56
AND be sure you correctly set the config fuses. See the FAQ about that.

willie
- 26th January 2006, 04:41
Pete and Steve thank for your reply.
Pete I do have the cmcon = 7 at tie top of my code.
And Steve I set the fuses to XT,MCLR to reset,Watchdog Timer on,Power-up Timer off.
But I still don't get anything.

Willie

milestag
- 26th January 2006, 14:27
Set MCLR to OFF, so it is an I/O pin, (otherwise you need a 5K resistor from MCLR (GP3) to +5V). Depends on your application. Do you need RESET? If not, then disable it and you get another input to use (GP3).

CMCON = 7 ' this turns the COMPARATOR off
ANSEL = 0 ' this turns the A/D convertors off

And don't forget that if you decide to use GP3 it is INPUT ONLY.

BTW - ALWAYS read the Datasheet!!! Look at the first few pages where is shows all the functions for each pin (especially the pin that is causing problems). If there are more functions than just "I/O" then you MUST go to those sections in the datasheet to see what the defaults are. Usually I/O is NOT the default. It's a little tedious at first, but saves a lot of headaches later. And usually you will find the answer quicker than asking here (but when you are really stuck, this forum is a life saver).

regards,
Jim