Full Test Code that I threw together to see if it would work with your ANSEL and TRISIO settings...
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
@ DEVICE pic12F675, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic12F675, PROTECT_OFF
' Program Code Protection
'
' Hardware Defines
' ----------------
LED var GPIO.5
GP3Pin var GPIO.3
'
' Software Defines
' ----------------
B1 var Byte
'
' Initialise PIC
' --------------
CMCON=%00000111
ANSEL=%00000000
TRISIO=%11111111
'
' Main Program Loop
' -----------------
Loop:
ADCIN 0,b1
If B1>127 then goto LEDOn
ADCIN 1,b1
If B1>127 then goto LEDOn
ADCIN 2,b1
If B1>127 then goto LEDOn
ADCIN 3,b1
If B1>127 then goto LEDOn
If GP3Pin=1 then goto LEDOn
High LED
Goto Loop
LEDOn:
Low LED
Goto Loop
end
I just grounded the inputs that I wasn't playing with and used a 10K pot betweedn Vdd and 0v with the wiper to the PIC to play with the pin of my choice. My LED was connected between Vdd and the PIC (via 330R Resistor), so a LOW turned it ON and a HIGH turned it OFF.
Melanie
Bookmarks