digital23 Posted June 6, 2005 Report Share Posted June 6, 2005 Hi there,does anyone has a code example for the following behaviour of an encoder:When tweaking slow, he should react precise. When tweaking fast, it should be possible to rise from 0 zo 127 with one 300° Turn. I thougt of combining a timer that measures the turning-speed and then to arrange the several speed procedures.Best regards,digital23 Quote Link to comment Share on other sites More sharing options...
moxi Posted June 6, 2005 Report Share Posted June 6, 2005 it's already implemented in some apps! Quote Link to comment Share on other sites More sharing options...
digital23 Posted June 6, 2005 Author Report Share Posted June 6, 2005 Oh, are there any apps-examples that I do not konw :o ?In what apps, please? Do you have code example for this? Thank you :)Regs,digital23 Quote Link to comment Share on other sites More sharing options...
Screaming_Rabbit Posted June 6, 2005 Report Share Posted June 6, 2005 Oh, are there any apps-examples that I do not konw :o ?In what apps, please? Do you have code example for this? Thank you :)Regs,digital23http://www.ucapps.de/mios_fun.html#MIOS_ENC_SpeedSetGreets, RogerMIOS_ENC_SPEED_FAST ~~~~~~~~~~~~~~~~~~~    ;; in this speed mode the increment value depends on the    ;; rotational speed based on the following formula:    ;;  speed_ctr: decremented with every update cycle    ;;  (-> MIOS_SRIO_UpdateFrqSet)    ;;        (normaly 1 ms) to measure the time between    ;;        two encoder steps    ;;        Init value: 0x7f    ;;        reaches 0x00 after 127 update cycles    ;;       (normaly after 127 ms)    ;;  MIOS_PARAMETER2: specified with the MIOS_ENC_SpeedSet    ;;    ;;           function, allowed values:    ;;            0 (fast)   -> divider = 2^(7-0) = 128    ;;            1 (faster)  -> divider = 2^(7-1) = 64    ;;            ...    ;;            7 (fastest) -> divider = 2^(7-7) =  1    ;; ->    ;;  incrementer = speed_ctr / (2^(7-MIOS_PARAMETER2))    ;; set speed for encoder #0 to "fast", speed exponent value is 2    movlw    0x02            ; speed exponent    movwf    MIOS_PARAMETER2    movlw    MIOS_ENC_SPEED_FAST    ; fast speed mode    movwf    MIOS_PARAMETER1    movlw    0x00            ; rotary encoder #0    call    MIOS_ENC_SpeedSet Quote Link to comment Share on other sites More sharing options...
digital23 Posted June 6, 2005 Author Report Share Posted June 6, 2005 Hey Roger, thank you!! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.