john green
Member
Greetings.
In the past I would use a flip flop to interpret the signals from two hall effect sensors to attain a quadrature output but would now like to do the same using a picaxe micro.
I have copied the following from a thread found from searching the subject. I think this will achieve exactly what I want but I am struggling to understand the code.
Can any of you geniuses out there add some clarifying explanation as to what is happening in the example and how this works.
Many thanks...
jg
'================================
'décodeur quadrature Version 03
'PieM 140505
'================================
#picaxe 08M2
symbol InputA = pinc.3
symbol InputB = pinc.4
symbol Comb_act = b0 'combinaison actuelle
symbol Comb_Preced = b1 'combinaison pecédente
symbol Compt = w3 'compteur
'________________________________________________
main:
do
bit0 = InputA
bit1 = InputB
if Comb_act <> Comb_Preced then
Compt = bit1 xor bit8 *2 + compt - 1
Comb_Preced=Comb_act
endif
loop
In the past I would use a flip flop to interpret the signals from two hall effect sensors to attain a quadrature output but would now like to do the same using a picaxe micro.
I have copied the following from a thread found from searching the subject. I think this will achieve exactly what I want but I am struggling to understand the code.
Can any of you geniuses out there add some clarifying explanation as to what is happening in the example and how this works.
Many thanks...
jg
'================================
'décodeur quadrature Version 03
'PieM 140505
'================================
#picaxe 08M2
symbol InputA = pinc.3
symbol InputB = pinc.4
symbol Comb_act = b0 'combinaison actuelle
symbol Comb_Preced = b1 'combinaison pecédente
symbol Compt = w3 'compteur
'________________________________________________
main:
do
bit0 = InputA
bit1 = InputB
if Comb_act <> Comb_Preced then
Compt = bit1 xor bit8 *2 + compt - 1
Comb_Preced=Comb_act
endif
loop
Last edited: