Need extra LED (MIOS 32)

Currently I am using one of the pins of Connector J5A as a DOUT to drive an LED to show the Status of a pedal on my digital piano. J5B and J5C are connected to hex switches and used to define two variables.

It would be convenient if I could use J5A to connect an additional rotary hex switch to change midi channels.

I am using the following connectors, J8/9, J5 (all), J17(usb), J15A

This means that I need to find a spare pin. I’ve looked at various options.

  1. The CAN interface. I am unlikely to use this. The pins are already used with the STM Primer and provide for 2 LED’s in that mode.

  2. I will not need both Midi In/Out. Currently I use neither.

3)There are other possibilities including J4,J3,J16,J19.

Any guidance will be appreciated.

Regards Robin

I have managed to solve my LED problem without the need for any alteration to the “standard” MIOS32 board set up.

I am using 2 rotary BCD switches to define the keyboard max and min delay parameters. These determine the max and min loudness.

I will use 2 Thumbwheel rotary hex switches to select two midi channels. One of these will be used when all the notes on the keyboard are using a single Midi channel. The second will be used for a split keyboard. In the latter case both Midi channel rotary thumbwheel switches will be used.

I’m currently only using 3 pins to provide 3 pedal Midi control signals. A few more pins will be needed for the split controls This will mean that I will need to use another row on the 16 X 16 matrix. This additional row will provide 16 more pins. I intend to limit the matrix to 13 rows. This will have nearly 20% impact on scan time and will require less memory.

All this means that I still have 11 of the pins available on J5. (One is used as a DOUT for pedal status).

I can use the rest of the pins as an analog inputs or for additional DOUT’s.

Here is the code I used to provide the keyboard parameters and the Midi Channel.

// Hex Sw to determine variable kb_del_fast


	u32 hex_switch_state_index = pin - 84;

	u8 midi_chn_1;


	hex_switch_state[hex_switch_state_index] = (pin_value ==0)	? 1 :0;


	if(pin >=84 && pin <= 95) 


	kb_del_fast = 25 + ((hex_switch_state[0]) | ((hex_switch_state[1])<<1) | ((hex_switch_state[2])<<2) 

	|((hex_switch_state[3] )<<3));


	kb_del_slow = 100*((hex_switch_state[11]) | ((hex_switch_state[10])<<1) | ((hex_switch_state[9])<<2) 

	|((hex_switch_state[8] )<<3));// sw order reversed


	midi_chn_1= ((hex_switch_state[7]) | ((hex_switch_state[6])<<1) | ((hex_switch_state[5])<<2) 

	|((hex_switch_state[4] )<<3));// 



	#if DEBUG_VERBOSE_LEVEL >= 1

    DEBUG_MSG("pin_value=0x%01x -> pin=%d, kb_del_fast=%d, kb_del_slow=%d,midi_chn_1=%d \n",

	pin_value, pin, kb_del_fast, kb_del_slow, midi_chn_1);

	#endif

Both type of switches “chatter” a little. It does not matter because the values are stored. After a few alterations the correct values are determined. This is demonstrated by the use of MIOS STUDIO and the Debug code.

This probably of interest to a few people. However it gives an example of the use of MIO32 and shows how arrays are used.

Regards Robin