Hello Guest it is July 16, 2019, 02:56:08 AM

Author Topic: Unstable analog inputs  (Read 4248 times)

0 Members and 1 Guest are viewing this topic.

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Unstable analog inputs
« Reply #10 on: February 02, 2012, 04:25:35 PM »
Nope... You're thinking INT(Y/Z*Z) but what we're doing is INT(Y/Z) * Z two vaaary difrant sings - simples!

(10/5)*5=10 ....... INT(10/5)*5=10 ............ INT(10/5) = 2 ........ 2*5 = 10
(11/5)*5=11 ....... INT(11/5)*5=10 ............ INT(11/5) = 2 ........ 2*5 = 10 etc.
(12/5)*5=12 ....... INT(12/5)*5=10
(13/5)*5=13 ....... INT(13/5)*5=10
(14/5)*5=14 ....... INT(14/5)*5=10
(15/5)*5=15 ....... INT(15/5)*5=15
(16/5)*5=15 ....... INT(15/5)*5=15

Ian
Re: Unstable analog inputs
« Reply #11 on: February 02, 2012, 04:39:58 PM »
Thank you, I'll play with that a little. I like it.

Tony
« Last Edit: February 02, 2012, 04:50:53 PM by Tony Bullard »

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Unstable analog inputs
« Reply #12 on: February 03, 2012, 04:47:20 AM »
Hi Tony - just for the fun of it...

a = getinput(64)
if ((a mod 6) > 0) then
  setDRO(21, INT(a / 6) + 45)
end if

This will map your 10bit ADC input to give you FROs in the range 45% to 215% with the input value having to change by a factor of 6 to change the output. There's a deadzone between each set to suppress jitter.

I understand why you chose 6.827 to give you EXACTLY 150% range but it doesn't really bring anything to the party and integer values allow the modulus to give you the deadzones. You can widen the deadzones by increasing the >0 to >1 or 2 but of course anything more than 4 and you'll have nothing but deadzone!

Ian
« Last Edit: February 03, 2012, 05:00:10 AM by stirling »
Re: Unstable analog inputs
« Reply #13 on: February 03, 2012, 07:19:49 AM »
Thanks Ian,

I've never worked with modular arithmetic but it will give this old man something to do today. LOL. I guess I'll start here: http://www.math.rutgers.edu/~erowland/modulararithmetic.html.

Tony

Offline stirling

*
  • *
  •  2,188 2,188
  • UK
    • View Profile
    • www.razordance.co.uk
Re: Unstable analog inputs
« Reply #14 on: February 03, 2012, 11:17:43 AM »
 :)