encoder speed readout issue
Im trying to read from some quadrature rotary encoders. i downloaded some code named QEDEngine.spin from the exchange. plugged the encoders into the propeller and am able to read "some" speed from them along with the delta position.
the problem is that when i read the speed i get a bunch of errors at the end (the very last value trails for a little after the encoder has stopped rotating)
Eg. serial terminal output:
0
-84
-177
-303
-556
-916
-830
-2494
-3225
-4086
-4907
-5779
-6500
-6963
-7221
-7155
-6902
-6240
-2859
-5167
-4701
-4218
-3681
-3160
-2701
-2224
-1690
-1351
-1054
-553
-259
309
289
191
191
191
191
191
191
191
0
0
0
im not sure whats wrong here...
and thanks for any help.
the problem is that when i read the speed i get a bunch of errors at the end (the very last value trails for a little after the encoder has stopped rotating)
Eg. serial terminal output:
0
-84
-177
-303
-556
-916
-830
-2494
-3225
-4086
-4907
-5779
-6500
-6963
-7221
-7155
-6902
-6240
-2859
-5167
-4701
-4218
-3681
-3160
-2701
-2224
-1690
-1351
-1054
-553
-259
309
289
191
191
191
191
191
191
191
0
0
0
im not sure whats wrong here...
CON
_clkmode = xtal1 + pll16x
_xinfreq = 6_250_000
VAR
LONG ABSOLUTE
long stack[20]
OBJ
NUM : "numbers"
Debug : "fullduplexserial"
Encoder : "QEDEngine"
PUB term
num.init
debug.start(31, 30, 0, 57600)
encoder.QEDEngine
cognew(calc, @stack)
repeat
debug.str(num.tostr(ABSOLUTE, num#dec))
debug.tx($0D)
waitcnt(1000000 + cnt)
PUB calc | state
dira[0]~~
dira[27]~~
outa[27]~~
dira[27]~
repeat
state := ina[27]
if state == 1
outa[0]~
if state == 0
outa[0]~~
ABSOLUTE := encoder.getSpeedA
and thanks for any help.
