Jump to content

Joystick pots on the SEQ


Recommended Posts

Hi,

I have four joystick pots lying around since I tried to mod my UC-33e. I have a BCR2000 so I don't really feel the need to build a controller MidiBox. But none the less, I'd like to use those pots. Here's my idea...

I'm building a MidiBox SEQ2, and I was thinking maybe I could incorporate the pots in that project. Not to deal with the actual sequencer, but rather as a means to send CCs on a given midi channel, for example.  I guess I'll have to get an AIN board, but is there an easy way of adding the extra code to the PIC, making the function available in parallell to the sequencer?

Regards,

Mikael

Link to comment
Share on other sites

Hi Mikael,

no problem, just write following code to the USER_AIN_NotifyChange hook in main.asm


;; --------------------------------------------------------------------------
;;  This function is called by MIOS when a Pot has been moved
;;  Input:
;;    o Pot number in WREG and MIOS_PARAMETER1
;;    o LSB value in MIOS_PARAMETER2
;;    o MSB value in MIOS_PARAMETER3
;; --------------------------------------------------------------------------
USER_AIN_NotifyChange
        ;; convert 10-bit value to 7-bit value
        rrf    MIOS_PARAMETER3, F      ; value / 2
        rrf    MIOS_PARAMETER2, F
        rrf    MIOS_PARAMETER3, F      ; value / 2
        rrf    MIOS_PARAMETER2, F
        rrf    MIOS_PARAMETER3, F      ; value / 2
        rrf    MIOS_PARAMETER2, F
        bcf    MIOS_PARAMETER2, 7      ; clear 8th bit

        ;; now: pot number in WREG and MIOS_PARAMETER1
        ;; 7-bit value in MIOS_PARAMETER2

;; send CC
movlw 0xb5 ; 0xb5 = CC, channel 6
call MIOS_MIDI_TxBufferPut
movf MIOS_PARAMETER1, W ; pot number is the CC number
call MIOS_MIDI_TxBufferPut
movf MIOS_PARAMETER2, W      ; 7-bit CC value
goto MIOS_MIDI_TxBufferPut
[/code]

in USER_Init you have to specifiy the number of pots - thats all

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...