-
PIC12F675 not working
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
-
Looks like a faulty device, bad hardware (socket/breadboard) or device programmer issue to me.
-
Assuming the chip is all right, check if your osccal value has been inadvertently erased.
Regards,
Anand
-
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.
-
Detail
Hi, Russ
WPU register settings are missing .... WHICH inputs must be pulled up ???
Alain
-
Thanks for your insight, I pulled the mosfet that was being driven and now the IC works. The mosfet was shorted.