I’m having some problems in trying to use a rotary switch to change the the Midi Channel.
There are some unused Shift Registers locations that I refer to as BANK 0 and BANK 1. See attached Table
I have allocated pins 80, 81, 82, 83 to the pins of the the HEX switch and had hoped to generate values (1 - 9) and (a - f).
I have used pins 84 and 85 to connect to the soft pedal and the sustain pedal switches.
The code for both is shown
//non-key switches
if((column >=0 && column <=7 ) && (row >= 10 && row <= 11)){
pin = 8* row + column;
if(pin == 84 && pin_value == 0) { // send soft pedal CC
MIOS32_MIDI_SendCC (KEYBOARD_MIDI_PORT,KEYBOARD_MIDI_CHN, 67, 127 ) ;}
if(pin == 84 && pin_value == 1) {
MIOS32_MIDI_SendCC (KEYBOARD_MIDI_PORT, KEYBOARD_MIDI_CHN, 67, 0 );}
if(pin == 85 && pin_value == 0) {// send sustain pedal CC
MIOS32_MIDI_SendCC (KEYBOARD_MIDI_PORT,KEYBOARD_MIDI_CHN , 64, 127 );}
if(pin == 85 && pin_value == 1) {
MIOS32_MIDI_SendCC (KEYBOARD_MIDI_PORT,KEYBOARD_MIDI_CHN , 64, 0 );}
//channel select
//uses pins (80 - 83) with 16 bit rotary Switch to give (0 - 9, a - f)
"Red Code"
if (pin == 80 && pin_value == 0) { w = 1;} //lsd bit
if (pin == 80 && pin_value == 1) { w = 0;} //lsd bit
if (pin == 81 && pin_value == 0) { x = 2;}
if (pin == 81 && pin_value == 1) { x = 0;}
if (pin == 82 && pin_value == 0) { y = 4;}
if (pin == 82 && pin_value == 1) { y = 0;}
if (pin == 83 && pin_value == 0) { z = 8;} //msd bit
if (pin == 83 && pin_value == 1) { z = 0;} //msd bit
//Chn = (w + x + y + z);
"End of Red Code"
MIOS32_MIDI_SendCC (KEYBOARD_MIDI_PORT,(w + x + y + z) , 30 , 0);// 30 (0x1e)undefined, 0 arbitrary
}
//right hand keys
The system does change the midi channel but the code in red does not work. I get only get a few channel values.
I suspect that the switch is no compatible and that the scan matrix is not suitable.
Is this suspicion correct?
I also think that I may be able to use a rotary switch where only only one pin of (say) 8 pins is connected to 0V at any time. (break-before-make type.) I think that any bounce would be tolerable. (giving multiple midi channel requests for the same channel)
Does this make sense.
Should I use the MIOS32 Encoder Functions with rotary edge hex switches?
Thanks
Robin
After I sent the above I read about the use of encoders with J5. These inputs configured as digital inputs will hopefully allow me to use three rotary hex switches without any more SR’s. Three such switches will allow me to control the Midi Channel No and the other two will be used to adjust the keyboard_delay_fastest and
keyboard_delay_slowest variables.
Is this the way to go?
[Connectin Diagram MIOS 32 Fast Scan with extra switches.doc](< base_url >/applications/core/interface/file/attachment.php?id=7878)