The question that first springs to mind is... "How do you know if your PIC actually ran"?
I always say that like a car engine, a PIC needs three things to run. Whilst a car needs fuel air and a spark, a PIC needs CLOCK, MCLR and VOLTS. I'll assume you got the VOLTS bit correct, so that leaves CLOCK and MCLR.
How have you arranged the OSCILLATOR and MCLR settings of your 12F675 as nothing you've posted hints at this arrangement.
Next a simple error, it won't affect your PIC's running, but you'll notice that GP.3 is an INPUT ONLY pin on this PIC. You've set TRISIO correctly by indicating it's an INPUT, but you then go and spoil it by setting GPIO as an output.
Try this simple piece of code...
Code:
'
' PIC Defines
' -----------
@ DEVICE pic12F675, INTRC_OSC_NOCLKOUT
' System Clock Options (Internal)
@ DEVICE pic12F675, WDT_ON
' Watchdog Timer
@ DEVICE pic12F675, PWRT_ON
' Power-On Timer
@ DEVICE pic12F675, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic12F675, BOD_ON
' Brown-Out Detect
'
' Hardware Defines
' ----------------
LED var GPIO.0
'
' Initialise
' ----------
TRISIO=%00001000
CMCON=%00000111
ANSEL=%00000000
'
' Program Body
' ------------
Loop:
Toggle LED
Pause 500
Goto Loop
End
You may compile this with the command line...
PBP -p12F675 myprog -v
Your PIC should work and toggle GPIO.0 pin at approximately 1Hz. You need do nothing else besides apply VOLTS and now MCLR and CLOCK will be taken care of internally. Go look at my usage of CMCON and ANSEL in the appropriate chapters of the PICs DATASHEET to discover why I have used them and for what purpose.
Bookmarks