Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/20/08 18:12
Read: times


 
#154970 - How I solved my Midi Controller LSB Flicker/Flutte
Responding to: ???'s previous message
Hello, Sorry, I'm very noob to everything about microcontrollers, but some time ago I had the same problem with my midi controller, asked help here and received the best help I could in the world... Hans Van Pelt teached me a slack algorithm, http://www.8052.com/forum/read.phtml?id=144532
I will post the code I'm using today, I hope this helps:

LinearControl is a feature I coded to interpolate the values, setting lin=0 it is disabled... setting lin>0 the controller will interpolate the previous value to the new one...


dir:			dbit	1
.......

READPot:
        CALL READADC        ; Read ADC Value in A
        MOV TH,A
        MOV TP,@R0          ; Remember previous value
        CLR C
        SUBB A,TP           ; Current - Previous
        
        MOV dir,C
        
        JNC ABSEND          ; If carry: result was negative, CPL IT!
        CPL A
        INC A


ABSEND: CJNE A,#2,TRESADC   ; Compare change to deadzone
TRESADC:JC INCI             ; less than value. ignore
        
        MOV A,lin
        
        CJNE A,#0,LinearControl
        MOV A,TH
        JMP SEND0

LinearControl:        
        MOV A,TP

        JNB dir,IncV
        CLR C
        SUBB A,#2
        JMP SEND0

IncV:   ADD A,#2

        
SEND0:  MOV @R0,A           ; Update ram value with new one
        CALL SEND



List of 41 messages in thread
TopicAuthorDate
ADC smoothing assistance...            01/01/70 00:00      
   Low-pass filter            01/01/70 00:00      
      How stabile is your power supply?            01/01/70 00:00      
         Not very, apparently.            01/01/70 00:00      
            Getting better...            01/01/70 00:00      
            To ground            01/01/70 00:00      
            Start by cleaning up the supply ...            01/01/70 00:00      
               Right!            01/01/70 00:00      
            Correction.            01/01/70 00:00      
               Maybe what you need is a low-impedance probe            01/01/70 00:00      
                  Springtime...            01/01/70 00:00      
                     yes, that looks like mine ... sort-of            01/01/70 00:00      
      Still listening...            01/01/70 00:00      
   Digital and Analog            01/01/70 00:00      
   try steady and more than minimum            01/01/70 00:00      
   ahhhhhh...........so its not only me!            01/01/70 00:00      
   is 2 lsb random error close enough?            01/01/70 00:00      
      Thanks...            01/01/70 00:00      
      Yep.....and that IS the final answer......            01/01/70 00:00      
      Don't truncate ...            01/01/70 00:00      
   LSB flickering            01/01/70 00:00      
      Erm ... not quite true.            01/01/70 00:00      
         Specific Case....            01/01/70 00:00      
            Should work in any case ...            01/01/70 00:00      
         Sorry, but you are entirely wrong...            01/01/70 00:00      
            You must know more about the flickering            01/01/70 00:00      
            I shouldn\\\'t post after a long workday ...            01/01/70 00:00      
   I need to chime in on this thread,,,,            01/01/70 00:00      
      throwing away bits            01/01/70 00:00      
      Integrate and Decimate            01/01/70 00:00      
         Here's my code            01/01/70 00:00      
            Where's the integration?            01/01/70 00:00      
         Dropping bits will not prevent flickering...            01/01/70 00:00      
            this confuses the issue            01/01/70 00:00      
               Immanent flickering            01/01/70 00:00      
                  I don't disagree ...            01/01/70 00:00      
                     Precision...            01/01/70 00:00      
   How I solved my Midi Controller LSB Flicker/Flutte            01/01/70 00:00      
      "Slack" same as hystersis            01/01/70 00:00      
         Sorry!            01/01/70 00:00      
      slack            01/01/70 00:00      

Back to Subject List