K8055 encoder bidirectional

I would like read a encoder bidirectional (add/sub) with k8055 (input 1 and 2): how can I do it?
I’m using VB

Thank You

quel type signal te retourne ton encondeur ?
[color=#0000FF]type signal you return your encondeur?[/color]
@++

It is a incremental encoder, with 2 output (A-B) delayed 90°

Flavio

whaou :unamused:
it’s not simple !
if you use a timer to read the digital input, (or a counter) it can’t distinct the time (90°)
this type of signal is like that :
00 /A./B
01 A./B
11 A.B
10 /A.B
00 goto
so you can use it for count the impulsion of encodeur.
Also you can just read the channel A, but you / by two the résolution of codeur.
But the time is yours not your friend ! 10ms by reading one instruction ! so the fréquency of codeur rotation must be very low !
regards

…otherwise i should use input 1 for the counter (only channel A) for ADD at 2khz. When the counter have to subtract, i should close input 2 + input 1 for encoder channel A (up to 2khz).
But how i can subtract? Is the function “readcounter” ADD only?

Thank You for your answer
Best Regards
Flavio

if you want to substract you must pass by a integer, with a the initial value
Ex
dim a as integer = 1024
dim b as integer= “the read encodeur”
dim as integer = a-b
is your answer ?