Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 11:52:59 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  General Mach Discussion
| | |-+  Unstable analog inputs
Pages: « 1 2   Go Down
Print
Author Topic: Unstable analog inputs  (Read 255 times)
0 Members and 2 Guests are viewing this topic.
stirling
Global Moderator
*
Offline Offline

Posts: 1,190

UK


View Profile WWW
« 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
Logged
Tony Bullard
Active Member

Offline Offline

Posts: 83


View Profile
« 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 » Logged
stirling
Global Moderator
*
Offline Offline

Posts: 1,190

UK


View Profile WWW
« 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 » Logged
Tony Bullard
Active Member

Offline Offline

Posts: 83


View Profile
« 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
Logged
stirling
Global Moderator
*
Offline Offline

Posts: 1,190

UK


View Profile WWW
« Reply #14 on: February 03, 2012, 11:17:43 AM »

 Smiley
Logged
Pages: « 1 2   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!