I have got a PIR sensor, I amplified it, and now I want to use the comparator inside the 16f88. The reference signal is 5 volt with a variable resistance. Somehow it doesn't work, when lowering the reference voltage PORTB still gives a high output.. But maybe I'm just making a very stupid mistake?
Code:
PROCESSOR 16F88
#include "p16f88.inc"
__config 0x1F04
ORG 0x00
goto Main
ORG 0x04
goto INR
Main banksel TRISA
movlw b'11100111'
movwf TRISA
clrf TRISB
movwf TRISB
banksel PORTB
movlw b'11111111'
movwf PORTB
banksel CMCON
movlw b'00000101'
movwf CMCON
banksel PIE2
bsf PIE2,CMIE
banksel INTCON
bsf INTCON,PEIE
bsf INTCON,GIE
INR
banksel PORTB
movlw b'00000000'
goto INR
RETFIE
End