====== Changing DIN pins in mbSID v2 ======
====== Overview ======
If you're like me, you'd rather change the software mapping of the Input pins than wire everything according to the original schematic - which may not even be possible due to differences in the CS. This HowTo will demonstrate one of the many ways to change the mapping according to your own wiring.
Difficulty level:
* easy 0-1-2-3-**4**-5-6-7-8-9 hard
Required actions:
* Search/manually edit
* Install other software
* Compile
Affected files [1]:
* ''setup_*.asm''
Required software:
* [[http://www.ucapps.de/mios/ain64_din128_dout128_v2_0.zip]]
\\
\\
====== Step-by-Step description ======
\\
\\
===== 1. Finding the correct pins =====
* Download the ain64_din128_dout128_v2_0 application
* Install it on the (master) core
* Power up the core. Your dispay should now show sth. like thisWaiting for DIN or
AIN event
* Upon pressing a button it will tell you the event number like this:Received a DIN
Event: 24/1
* Press every button and write down the corresponding number (the ''24'' in the example above)
* Do the same thing for the encoders. This is a bit more tricky as an encoder movement triggers 2 events. If you move the encoder back and forth a bit you should get two events. One of which is the predecessor of the other (for instance 24 and 25)
* Write down the smaller number (this *must* be an even number)
* At this point you know how your buttons and encoders are connected
\\
\\
===== 2. Translating the events to SR & Pin =====
* For each button event number you've written down the SR & Pin numbers are
* C-Syntax: SR = ((event_number-1) / 8) + 1; Pin = (event_number-1) % 8;
* Pascal-Syntax: SR := ((event_number-1) DIV 8) + 1; Pin := (event_number-1) MOD 8;
* In plain english SR is the (event number minus 1) divided by 8 (using integer division) plus 1, and the Pin is the remainder of that division.
* Do the same thing for the smaller number of each encoder
* You should now have a pair of numbers for each encoder/button on your box
\\
\\
===== 3. Changing the source code for the buttons =====
* Open ''setup_*.asm''
* Find the table called ''CS_MENU_DIN_TABLE'' which looks like this:CS_MENU_DIN_TABLE
;; Function name SR# Pin#
DIN_ENTRY CS_MENU_BUTTON_Dec, 1, 0 ; only valid if rotary encoder not assigned to these pins
DIN_ENTRY CS_MENU_BUTTON_Inc, 1, 1 ; (see mios_tables.inc) and CS_MENU_USE_INCDEC_BUTTONS == 1
DIN_ENTRY CS_MENU_BUTTON_Exec, 1, 2
DIN_ENTRY CS_MENU_BUTTON_Sel1, 1, 7
DIN_ENTRY CS_MENU_BUTTON_Sel2, 1, 6
DIN_ENTRY CS_MENU_BUTTON_Sel3, 1, 5
DIN_ENTRY CS_MENU_BUTTON_Sel4, 1, 4
DIN_ENTRY CS_MENU_BUTTON_Sel5, 1, 3
DIN_ENTRY CS_MENU_BUTTON_Sel6, 0, 0 ; define this if CS_MENU_DISPLAYED_ITEMS > 5
DIN_ENTRY CS_MENU_BUTTON_Sel7, 0, 0 ; define this if CS_MENU_DISPLAYED_ITEMS > 5
DIN_ENTRY CS_MENU_BUTTON_Sel8, 0, 0 ; define this if CS_MENU_DISPLAYED_ITEMS > 5
DIN_ENTRY CS_MENU_BUTTON_Sel9, 0, 0 ; define this if CS_MENU_DISPLAYED_ITEMS > 5
DIN_ENTRY CS_MENU_BUTTON_Sel10, 0, 0 ; define this if CS_MENU_DISPLAYED_ITEMS > 5
DIN_ENTRY CS_MENU_BUTTON_SID1, 2, 0
DIN_ENTRY CS_MENU_BUTTON_SID2, 2, 1
DIN_ENTRY CS_MENU_BUTTON_SID3, 2, 2
DIN_ENTRY CS_MENU_BUTTON_SID4, 2, 3
DIN_ENTRY CS_MENU_BUTTON_Shift, 2, 4 ; was: link button
DIN_ENTRY CS_MENU_BUTTON_CC_PageUp, 2, 5 ; combined CC/PageUp -- CC actived together with shift button (no error)
DIN_ENTRY CS_MENU_BUTTON_Edit_PageDown, 2, 6 ; combined Edit/PageDown -- Edit actived together with shift button (no error)
DIN_ENTRY CS_MENU_BUTTON_Osc_Sel, 4, 2
DIN_ENTRY CS_MENU_BUTTON_Osc_Ctrl, 4, 3
DIN_ENTRY CS_MENU_BUTTON_Osc_Wav, 4, 4
DIN_ENTRY CS_MENU_BUTTON_Osc_RS, 4, 5
DIN_ENTRY CS_MENU_BUTTON_LFO_Sel, 5, 2
DIN_ENTRY CS_MENU_BUTTON_LFO_Wav, 5, 3
DIN_ENTRY CS_MENU_BUTTON_Env_Sel, 7, 2
DIN_ENTRY CS_MENU_BUTTON_Env_Ctrl, 7, 3
DIN_ENTRY CS_MENU_BUTTON_Fil_Sel, 7, 4
DIN_ENTRY CS_MENU_BUTTON_Fil_Mod, 7, 5
DIN_ENTRY CS_MENU_BUTTON_M_O1Ptch, 7, 6
DIN_ENTRY CS_MENU_BUTTON_M_O2Ptch, 7, 7
DIN_ENTRY CS_MENU_BUTTON_M_O3Ptch, 8, 0
DIN_ENTRY CS_MENU_BUTTON_M_O1PW, 8, 1
DIN_ENTRY CS_MENU_BUTTON_M_O2PW, 8, 2
DIN_ENTRY CS_MENU_BUTTON_M_O3PW, 8, 3
DIN_ENTRY CS_MENU_BUTTON_M_Filter, 8, 4
DIN_ENTRY CS_MENU_BUTTON_M_E1, 8, 5
DIN_ENTRY CS_MENU_BUTTON_M_E2, 8, 6
DIN_ENTRY CS_MENU_BUTTON_M_L1, 8, 7
DIN_ENTRY CS_MENU_BUTTON_M_L2, 9, 0
DIN_ENTRY CS_MENU_BUTTON_M_L3, 9, 1
DIN_ENTRY CS_MENU_BUTTON_M_L4, 9, 2
DIN_ENTRY CS_MENU_BUTTON_M_L5, 9, 3
DIN_ENTRY CS_MENU_BUTTON_M_L6, 9, 4
DIN_ENTRY CS_MENU_BUTTON_M_Vol, 9, 5 ; (new, button below M_Filter, you could also re-arrange the assignment if you want)
;; new for MBSID V2 (additional ***optional*** buttons)
;; don't worry, you still have full access to all functions w/o these buttons!
;; note that you could also re-arrange the pin assignments if required (e.g. if you don't like a certain button function)
DIN_ENTRY CS_MENU_BUTTON_M_Vol, 9, 5 ; matrix: button below M_Filter
DIN_ENTRY CS_MENU_BUTTON_Play, 9, 6 ; direct access to play function
DIN_ENTRY CS_MENU_BUTTON_SID_LR, 9, 7 ; direct access to L/R toggling
DIN_ENTRY CS_MENU_BUTTON_M_Mode, 10, 0 ; direct access to meter on/off function
DIN_ENTRY CS_MENU_BUTTON_Fil_ExtIn, 10, 1 ; direct access to Filter ExtIn Flag
DIN_ENTRY CS_MENU_BUTTON_Sync, 10, 2 ; jumps to ENS->CLK menu
;; don't remove this "end-of-table" entry!
DIN_ENTRY_EOT
* All you need to change is the 3rd and 4th column (SR# and Pin#)
* I usually set all SR# and Pin# to 0 before changing anything - that way it's hard to miss anything and it keeps you from having doubles if you do not use of the buttons
* Go through your list of buttons and adjust the SR# and Pin# according to the numbers you've written down in the previous step
* Done with the buttons
\\
\\
===== 4. Changing the source code for the encoders =====
* (re-)open ''setup_*.asm''
* Find the table called ''MIOS_ENC_PIN_TABLE'' which looks like thisMIOS_ENC_PIN_TABLE
;; SR Pin Mode
#if CS_MENU_USE_INCDEC_BUTTONS == 0
ENC_ENTRY 1, 0, MIOS_ENC_MODE_DETENTED2 ; menu encoder
#endif
;; additional CS encoders
;; SR Pin Mode
ENC_ENTRY 3, 0, MIOS_ENC_MODE_DETENTED2 ; Osc delay/transpose/assign #1
ENC_ENTRY 3, 2, MIOS_ENC_MODE_DETENTED2 ; Osc attack/finetune/assign #2
ENC_ENTRY 3, 4, MIOS_ENC_MODE_DETENTED2 ; Osc decay/portamento/assign #3
ENC_ENTRY 3, 6, MIOS_ENC_MODE_DETENTED2 ; Osc sustain/release/assign #4
ENC_ENTRY 3, 8, MIOS_ENC_MODE_DETENTED2 ; Osc release/pulsewidth/assign #5
ENC_ENTRY 4, 6, MIOS_ENC_MODE_DETENTED2 ; LFO rate
ENC_ENTRY 5, 0, MIOS_ENC_MODE_DETENTED2 ; LFO depth
ENC_ENTRY 5, 4, MIOS_ENC_MODE_DETENTED2 ; Filter CutOff
ENC_ENTRY 5, 6, MIOS_ENC_MODE_DETENTED2 ; Filter Resonance
ENC_ENTRY 6, 0, MIOS_ENC_MODE_DETENTED2 ; Env depth/assign #1
ENC_ENTRY 6, 2, MIOS_ENC_MODE_DETENTED2 ; Env attack/assign #2
ENC_ENTRY 6, 4, MIOS_ENC_MODE_DETENTED2 ; Env decay/assign #3
ENC_ENTRY 6, 6, MIOS_ENC_MODE_DETENTED2 ; Env sustain/assign #4
ENC_ENTRY 7, 0, MIOS_ENC_MODE_DETENTED2 ; Env release/assign #5
;; don't remove this "end-of-table" entry!
ENC_EOT
* This time change columns 2 and 3 (SR and Pin) like before
* Done with the encoders
\\
\\
===== 5. Recompile =====
* Now recompile the setup_*.asm
* Send it to your mbSID via MIOSStudio
* You're all done!