Encoder mode and rotary encoders as tuning knobs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 10:23 AM
I understand that a timer (that supports encoder mode) can be used for keeping track of a rotary incremental encoder, but is there a good way of making the value saturating? So that when turned 'forward' the value increments to a given value and stops incrementing even if the knob is turned further, and the same way when turned 'backward' - the counter value saturates to zero.
#encoder-mode #rotary-encoderSolved! Go to Solution.
- Labels:
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-30 3:01 AM
I know of no simple way of making the timer 'saturate', but you could do this easily in software when reading out the timer value, something along these lines:
global:
#define DIAL_VALUE_MIN 12#define DIAL_VALUE_MAX 4253uint16_t dialValue = DIAL_VALUE_MIN;local:uint16_t t;static uint16_t oldt;int32_t delta;t = TIM3->CNT;delta = (int32_t)(int16_t)(t - oldt);delta += dialValue;if (delta < DIAL_VALUE_MIN) delta = DIAL_VALUE_MIN; else if (delta > DIAL_VALUE_MAX) delta = DIAL_VALUE_MAX;dialValue = delta;JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 1:29 PM
Yes, you would need to enable the interrupts and test/block it manually.
the nature of rotary encoders is endless counting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 2:00 PM
OK, thanks. So there is no HW-setting. I think I'll then need to poll the counter value often enough so that the value doesn't change too much (maybe about +/- quarter of the full range to tell the difference between positive and negative change) and keep record of the value in SW adding/subtracting the read counter value - as long as the total is within the allowed range. I guess interrupts don't help me here, because when saturated, the counting needs to continue immediately if the knob is turned in the opposite direction.
(BTW, why does the site show stars in place of the word 'k n o b'?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 2:32 PM
Well, does anyone know a politically correct word to use instead?
(I'm a Finn, English is not my native language.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 3:11 PM
turboscrew wrote:
(BTW, why does the site show stars in place of the word 'k n o b'?)
NSFW:
https://www.urbandictionary.com/define.php?term=knob
EDIT
Ha ha - it even censored the web link!
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 3:17 PM
Hmm, I think I could get used to 'dial'...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 3:42 PM
spindle?
dial?
EDIT
And yet it allowed 'knobs' (plural) in the title
EDIT
A complex system designed from scratch never works and cannot be patched up to make it work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 4:02 PM
Jog shuttle is used in tv production.
In this case it's a jog dial.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 5:45 PM
You chose the correct word - why 'k n o b' is censored is beyond me...bad software?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-03-24 5:55 PM
Because, in certain contexts, it is used as a rude word - see
https://www.urbandictionary.com/define.php?term=knob
[NSFW]
Presumably, the censor is just using a simple dictionary lookup - with no context awareness.
A complex system designed from scratch never works and cannot be patched up to make it work.
