PDA

View Full Version : Circuit will not power up initially - 12F629



BGreen
- 19th March 2005, 02:27
This is the segment of code at the beginning on of my program. On startup Power (pin 2) is suposed to go High to activate powering up an external item. Does anyone see anything that would prevent this? It just sits in a Low condition.

@ DEVICE pic12F629, INTRC_OSC_NOCLKOUT ; System Clock Options
@ DEVICE pic12F629, WDT_ON ; Watchdog Timer
@ DEVICE pic12F629, PWRT_ON ; Power-On Timer
@ DEVICE pic12F629, MCLR_OFF ; Master Clear Options (Internal)
@ DEVICE pic12F629, BOD_OFF ; Brown-Out Detect
@ DEVICE pic12F629, CPD_ON ; Data Memory Code Protect
@ DEVICE pic12F629, PROTECT_OFF
' I/O definition
TRISIO = %00011000
;
'WEAK PULLUPS
WPU = %00100111
;
' Variable Definition
POWER VAR GPIO.5
DNITE VAR GPIO.4
TRIGGER VAR GPIO.0
INPUT dnite
BO VAR word
;
'SET BO COUNTER TO 0 INITIALLY
BO = 0
;
; Set External interrupt (GPIO.2) with falling edge trigger...
OPTION_REG = %00001000 ; Falling edge trigger on GP.2
CMCON = 7
INTCON = %10000000 ; Set GIE - clear interrupt enable bit and flags.
;
'BODY OF CODE BEGINS
high power
pause 15000
low power
GOTO BASE ; Skip past interrupt handler

GregK
- 20th March 2005, 16:15
Hi

I had a similar problem with a 12F683. Read Bruce's reply to my thread "12F683 Startup" posted on March 17. Look and compare both chips, I believe they have similar features. If they do, I would replace your settings with his.

A couple things I see missing are: OPTION_REG.7 = 0 'Enable internal p/u's., ANSEL = 0 'If all digital inputs, CMCONO = 7 'Comparators off. Also your internal pullups don't match your TRIS settings, pullups only on inputs.

Are you properly interfacing the output pin to the load? I believe 20ma. max.

Hope this helps.

Greg