Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top