PDA

View Full Version : PIC12F675 not working



Russ Kincaid
- 26th March 2009, 00:44
I have use this configuration before with no problem, I don't know what is wrong. GPIO.0 never goes high.

REM DEVICE = 12F675
CMCON = 7 'SETS DIGITAL MODE
ANSEL = 0 'GPIO.0 TO GPIO.3 SET AS DIGITAL
OPTION_REG = 0 'WEAK PULLUPS ENABLED
TRISIO = %00001100 'GPIO.2 AND GPIO.3 SET AS INPUT
VRCON.7 = 0 'TURN OFF VOLTAGE REFERENCE
' ************************************************** ***************
'CONDITIONS: INTERNAL OSC CLOCK OUT, WDT DISABLED, PWR UP TIMER DISABLED,
'MCLR FUNCTION: INPUT PIN, BROWN OUT RESET DISABLED, NO PROTECTION
DEFINE OSCCAL_1K 1 'SAVES OSCILLATOR CALIBRATION
START:
HIGH GPIO.0
PAUSE 100
LOW GPIO.0
PAUSE 100
IF NOT GPIO.2 AND NOT GPIO.3 THEN START 'IF BOTH ARE LOW, THEN LOOP
LOW GPIO.0
PAUSE 500

IF GPIO.2 OR GPIO.3 THEN HIGH GPIO.0 'ENERGIZE RELAY
IF NOT GPIO.2 AND NOT GPIO.3 THEN DELAY
GOTO START


DELAY:
PAUSE 2000 '2 SECONDS
LOW GPIO.0 'DE-ENERGIZE RELAY
GOTO START
END

mister_e
- 26th March 2009, 01:07
Looks like a faulty device, bad hardware (socket/breadboard) or device programmer issue to me.

ardhuru
- 26th March 2009, 05:14
Assuming the chip is all right, check if your osccal value has been inadvertently erased.

Regards,

Anand

Archangel
- 26th March 2009, 05:20
Hi Russ,
You have not included any config statement, check your 12F675.inc file to make sure you have not commented them out. I am thinking maybe you have none going into your code.

Acetronics2
- 26th March 2009, 08:29
Hi, Russ

WPU register settings are missing .... WHICH inputs must be pulled up ???

Alain

Russ Kincaid
- 26th March 2009, 17:40
Thanks for your insight, I pulled the mosfet that was being driven and now the IC works. The mosfet was shorted.