Reading encoder

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Jan Middel
Posts: 7
Joined: Sun Nov 18, 2007 11:23 am
Contact:

Reading encoder

Post by Jan Middel »

Hello,

I'm working for an encoder to read.
This is not like I want
The rotation is not stable to read.
I have read devers forums.
but do not come out how to do it.
Can someone help me?
I have a program as an example
I have the encoder connected under this scheme

Groeten Jan
Attachments
Encoder_versie_#6.fcf
Programma
(6.5 KiB) Downloaded 336 times
Schema
Schema
Encoder.GIF (8.3 KiB) Viewed 3049 times

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: Reading encoder

Post by Sean »

Hello Jan.

Reading a quadrature encoder by using one channel as a clock (interrupt) and the other channel for direction can result in false readings, especially when changing the direction of rotation, or if the encoder stops with the clock line close to an edge (introducing jitter).

The 10ms delay in the interrupt service routine might also be the cause of some problems.

If the expected signal frequency is relaively low, it might be possible to use a timer interrupt to trigger a read of both of the encoder signals at regular intervals. A full quadrature decoding of the signal changes in the interrupt service routine should provide greater immunity from false edges, and increase the effective resolution of the encoder by a factor of 4 - the systm can respond to all 4 signal changes in a single cycle.

moxy
Posts: 14
Joined: Thu Nov 20, 2008 4:42 pm
Contact:

Re: Reading encoder

Post by moxy »

Hello Jan, It looks like you are building the same thing as me! My project is a manual pulse generator for a cnc milling machine. I am using a stepper motor to provide the detents (you will be able to vary the detent strength by applying some power to the stepper via a resistor) and the encoder is already mounted to the stepper so the hardware is already built. The encoder is a 1000line unit and I have written some code to divide it down to 200 line output to match the stepper.I would be very interested to know how your code is progressing.
Bes Regards
Les

Post Reply