PIC Assembler users - rotary encoder routines?

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: PIC Assembler users - rotary encoder routines?

Re: PIC Assembler users - rotary encoder routines?

by VK5TM » Thu Nov 22, 2018 2:56 am

Thanks Rob.

I've tried one like that but it was very twitchy around the step size change point.

Really needed some hysteresis added in to make it less twitchy.

Must go and look at which of the PIC's have a built in Encoder port and get some samples. :)

Re: PIC Assembler users - rotary encoder routines?

by M0XXQ » Wed Nov 21, 2018 7:57 am

Hey Terry, can't be much help ASM mate but C and C++ no problems.
I wrote such a routine for my Arduino based AD9959 DDS, so rather than go into code as it was done in C++ I will talk about it as a function.
Essentially what you need to do is monitor the encoder RPM with a counter and a timer, once the counter has reached a predetermined limit and the timer has elapsed X milli second's you switch the step size radix from say 10Hz to 100Hz.
Of course you need to monitor this the other way for different tuning directions and use signed Integer data types as counters may go negative.
When I get back to the hotel later I shall knock up a block diagram of the function to better illustrate what I am on about.

Cheers

Rob

PIC Assembler users - rotary encoder routines?

by VK5TM » Wed Nov 21, 2018 4:56 am

I'm hoping that somewhere amongst the various members here there may be some users of the PIC micro.

If there is, has anybody come across (or has and is willing to share) a routine for a rotary encoder that will work much like on a commercial rig, as in, as you spin the encoder faster, the frequency step size increases.

I've tried some routines from way back in the dark ages, but they just don't work smoothly (if at all) or just don't feel right for some reason.

This has been a thorn in my side for years trying to get a decent routine for use on my DDS projects.

Please note I program in assembler, 'C' just makes this old brain seize up with it's weird syntax, vague plot lines and ..... :?: ... snore!

Top