PLUS+1 User Forum

PLUS+1 Software => Displays => Topic started by: DENIS on November 09, 2010, 03:13:24 PM

Title: Transform encoder pulses!
Post by: DENIS on November 09, 2010, 03:13:24 PM
I need help to transform a rotary encoder pulses of 250 pulses per revolution in linear length.
anyone have an example of how to do this?
Title: Re: Transform encoder pulses!
Post by: Quax76 on November 10, 2010, 09:00:31 AM
Hi DENIS,

I would try to trigger on rising edge and simply add the calculated distance from imp to imp (Pi * diameter / imps per rev) . I use a similar function in one of my projects and modified it like I think it should work (not compiled or tested).



(http://img197.imageshack.us/img197/4923/screenshot1011201008544.png) (http://img197.imageshack.us/i/screenshot1011201008544.png/)

Uploaded with ImageShack.us (http://imageshack.us)
Title: Re: Transform encoder pulses!
Post by: DENIS on November 17, 2010, 12:37:45 PM
good day

tools are digital transition and does not compile with input frequency
Title: Re: Transform encoder pulses!
Post by: Rafal_Typiak on November 17, 2010, 12:56:44 PM
I may be not getting something here, but you shouldn't have a freqency signal when using encoder inputs. It's a simple digital one. If pin 8 is set to T, that it's a ground activated input. That's it.
I also don't fully understand the 'linear' part. Are you talking about some sort of a 'what distance has the encoder traveled while turning 1 step'? If so than count the steps, divide them by 250 and than multiply them by 2*pi*R  ;D

Or maybe you're reffering to Quax's example. Whell the thing here is that ... it's an example. It's not a solution for YOUR problem. It's one of his. :)
You just have to mingle with it to get your own solution. It's not that hard. :)
Title: Re: Transform encoder pulses!
Post by: Quax76 on November 17, 2010, 01:57:11 PM
Rafal is right. Which Pin on which Display do you want to use and what kind of signal do you have from your rotary encoder?
My excample works, if you connect it to a MF input and create a toggling signal with a compare component (e.g. "your" 0 line is at 0.5V, just compare the voltage input with 500(mV) and connect it to my "frq_in".
@Rafal:
Your calculation is excatly, what I did in my excample, just using the diameter instead of the radius and multiplying with 314 instead of pi because of the extraordinaly good floating point performance of Plus1
Title: Re: Transform encoder pulses!
Post by: Rafal_Typiak on November 22, 2010, 07:33:35 AM
@Quax
Yeah, I noticed that. It's just that I wrote the equation in  my reply before I've read your entire answer and afterwards I thought I wouldn't erase it as it always seems smarter when you put in some Math :P
Additionally I'm all for using 314 as pi.