Hi all!
A & B is PIC input sensors. When it cross its giving an input to the PIC. What I want is
*When an object moves from A to B it must increment a value.
*When the object moves from B to A it must decrement the current value.
Any simple way to do this?
A & B is PIC input sensors. When it cross its giving an input to the PIC. What I want is
*When an object moves from A to B it must increment a value.
*When the object moves from B to A it must decrement the current value.
Any simple way to do this?
Code:
Out btfss PORTB,A ;has it cross A sensor?
goto In
btfsc PORTB,A ;is still in front of A sensor?
goto $-1
bsf ENTER,IN
bcf ENTER,OUT
goto In
In btfss PORTB,B ;has it cross B sensor?
goto Out
btfsc PORTB,B ;is still in front of B sensor?
goto $-1
bcf ENTER,IN
bsf ENTER,OUT
goto Out