Lo-Fi_Massahkah Posted March 15, 2005 Report Share Posted March 15, 2005 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 Quote Link to comment Share on other sites More sharing options...
TK. Posted March 15, 2005 Report Share Posted March 15, 2005 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 allBest Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
Lo-Fi_Massahkah Posted March 15, 2005 Author Report Share Posted March 15, 2005 Thanks Thorsten,I should have been more observant to put it in the right forum. :-\Wow... Is it really this simple - seems to good to be true!Cheers,Mikael Quote Link to comment Share on other sites More sharing options...
stryd_one Posted March 16, 2005 Report Share Posted March 16, 2005 TK always makes things so easy . He's the MAN! ;D 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.