Detecting a Break in Beam

Status
Not open for further replies.

Omar.M

Member
Hello,
I want to make a cool, entrance light for my room. I am thinking of using an Infrared LED emitter, and a phototransistor. I want to detect if the beam is broken, and turn on the LEDs in a pattern.

I am thinking of using a 16F628A, 16F630 or 16F688 with BASIC. I have no idea how to do this, any help would be appreciated.

Thanks,
Omar
 
Active HIGH Logic: LOW-->HIGH
====================
#DEFINE IR_RX PORTB, 1
MOVLW B'00000010'
MOVWF TRISB

MAIN:
BTFSS IR_RX
GOTO $ - 1

DO_PATTERNS:
...
...
...

GOTO MAIN
END_MAIN:


Active LOW Logic: HIGH-->LOW
====================
#DEFINE IR_RX PORTB, 1
MOVLW B'00000010'
MOVWF TRISB

MAIN:
BTFSC IR_RX
GOTO $ - 1

DO_PATTERNS:
...
...
...

GOTO MAIN
END_MAIN:



Active HIGH + Debounce Filter Logic: LOW-->HIG(SUPRESS)->LOW-->HIGH
====================
#DEFINE IR_RX PORTB, 1
MOVLW B'00000010'
MOVWF TRISB

MAIN:
BTFSS IR_RX
CALL X_MILLISEC_DELAY
BTFSS IR_RX
GOTO $ - 3

DO_PATTERNS:
...
...
...

GOTO MAIN
END_MAIN:



Pulse HIGH + Debounce Filter Logic: LOW-->HIGH->LOW
====================
#DEFINE IR_RX PORTB, 1
MOVLW B'00000010'
MOVWF TRISB

MAIN:
BTFSS IR_RX
CALL X_MILLISEC_DELAY
BTFSS IR_RX
GOTO $ - 3
BTFSC IR_RX
GOTO $ - 1


DO_PATTERNS:
...
...
...

GOTO MAIN
END_MAIN:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…