Slotted Optical Switch
Archiver
Posts: 46,084
I have a Optek OPB820S12 Slotted Optical Switch that I
want to use as part of a "turns" counter. I
determined the proper connection and using a card in
the slot was able to get continuity through the C/E,
collector/emitter, side, by moving the card in and out
of the slot. I need help in properlly connecting the
switch to a BS2, plus programming assistance, to count
the number of turns on a shaft.
I ran a simple experiment by connecting the switch
between pin-7, of the BS2, and a 2-volt supply. The
program was to "Input-7", if IN7 was 1, print "switch
on", if IN7 was 0, print "switch off". when I ran the
program with no power to the switch the results were
"switch off". When I applied power to the switch but
didn't block the Input Diode, it printed "switch on".
When I inserted the card to block the diode, it
program jumped between "on" and "off". I tried a
"pulsin" ,(pulsin 7,0,b), command and a black wheel,
with a hole at the outside diameter, mounted to a
power screwdriver. Again ran the program with debug
"DEC b", and value was erractic, even though the
screwdriver was at a constant RPM.
Any guidance would be greatly appreciated.
Thank you
Brian Mc.
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
want to use as part of a "turns" counter. I
determined the proper connection and using a card in
the slot was able to get continuity through the C/E,
collector/emitter, side, by moving the card in and out
of the slot. I need help in properlly connecting the
switch to a BS2, plus programming assistance, to count
the number of turns on a shaft.
I ran a simple experiment by connecting the switch
between pin-7, of the BS2, and a 2-volt supply. The
program was to "Input-7", if IN7 was 1, print "switch
on", if IN7 was 0, print "switch off". when I ran the
program with no power to the switch the results were
"switch off". When I applied power to the switch but
didn't block the Input Diode, it printed "switch on".
When I inserted the card to block the diode, it
program jumped between "on" and "off". I tried a
"pulsin" ,(pulsin 7,0,b), command and a black wheel,
with a hole at the outside diameter, mounted to a
power screwdriver. Again ran the program with debug
"DEC b", and value was erractic, even though the
screwdriver was at a constant RPM.
Any guidance would be greatly appreciated.
Thank you
Brian Mc.
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
Comments
volts for a good solid logic 1 (hi). Logic hi above 3.8, logic lo below .8
anything in between may give erratic results.
Bruce