I can’t really understand how to modify the code …
I think to have to modify the MB64e_buttons.inc … but i don’t exactly know how to …
;; --------------------------------------------------------------------------
;; general purpose button function
;; Input:
;; o Button number in MIOS_PARAMETER1 (AND NOT IN WREG!)
;; o Button value MIOS_PARAMETER2:
;; - 1 if button has been released (=5V)
;; - 0 if button has been pressed (=0V)
;; --------------------------------------------------------------------------
MB64E_BUTTON_GP
;; save current button number in MB64E_CURRENT_BUTTON
SET_BSR MB64E_BASE
movf MIOS_PARAMETER1, W
movwf MB64E_CURRENT_BUTTON, BANKED
;; branch to SFB handler if button has been assigned to 0xff
call MB64E_FSR_ButtonEvnt0
incf INDF0, W
bnz MB64E_BUTTON_GP_NoSFB
MB64E_BUTTON_GP_SFB
;; toggle LED which is assigned to the SFB
rcall MB64E_LED_Set ; expects MIOS_PARAMETER[12] as parameter
;; request display re-initialization
bsf CS_STAT, CS_STAT_DISPLAY_INIT_REQ
;; save value in MIDI_EVNT_VALUE
;; (do it here, since MIOS_PARAMETER2 will be overwritten by MB64E_BANK_Read)
movff MIOS_PARAMETER2, MIDI_EVNT_VALUE
;; save SFB event number in MIDI_EVNT0
call MB64E_FSR_ButtonEvnt1
movff INDF0, MIDI_EVNT0
;; save special function parameter value in MIDI_EVNT1
;; calc address to button mode entry:
call MB64E_ADDR_ButtonEntry
;; select the 3th byte
movlw 3-1
addwf MB_ADDRL, F
;; save it in MIDI_EVNT1
call MB64E_BANK_Read
movwf MIDI_EVNT1
;; branch to SFB handler
goto MB64E_SFB_Handler
MB64E_BUTTON_GP_NoSFB
;; save it also in MB64E_LAST_BUTTON
movff MB64E_CURRENT_BUTTON, MB64E_LAST_BUTTON
;; notify that last controller move was a button
bsf MB_STAT, MB_STAT_LAST_WAS_BUTTON
;; for MIDI learn function
rcall MB64E_BUTTON_Learn
;; exit here if we are in learn mode (don't send button value)
IFSET MB_STAT, MB_STAT_LEARN_MODE, return
;; store current button value in TMP1
movf MIOS_PARAMETER2, W
movwf TMP1
;; calc address to button mode entry:
call MB64E_ADDR_ButtonEntry
;; select the 4th byte
movlw 4-1
addwf MB_ADDRL, F
;; get fourth byte - which selects the button mode - and branch depending on value
call MB64E_BANK_Read
andlw 0x03
JUMPTABLE_2BYTES_UNSECURE
rgoto MB64E_BUTTON_OnOff
rgoto MB64E_BUTTON_OnOnly
rgoto MB64E_BUTTON_Toggle
rgoto MB64E_BUTTON_OnOff
;; (button value stored in TMP1)
MB64E_BUTTON_OnOff
;; save status of button
rcall MB64E_BUTTON_Hlp_SaveStat
rgoto MB64E_BUTTON_Send
;; (button value stored in TMP1)
MB64E_BUTTON_OnOnly
;; save status of button
rcall MB64E_BUTTON_Hlp_SaveStat
;; when on: send button value defined in dump
;; when off: send nothing
IFSET TMP1, 0, rgoto MB64E_BUTTON_NotifyChangeEnd
rgoto MB64E_BUTTON_Send
;; (button value stored in TMP1)
MB64E_BUTTON_Toggle
;; when on: toggle between 0x00 and the button value defined in dump
;; when off: send nothing
IFSET TMP1, 0, rgoto MB64E_BUTTON_NotifyChangeEnd
;; toggle appr. bit in BUTTON_VALUE register
call MB64E_FSR_ButtonValue
SET_BSR MB64E_BASE
movf MB64E_CURRENT_BUTTON, W, BANKED
call MIOS_HLP_GetBitORMask
xorwf INDF0, F
;; rgoto MB64E_BUTTON_Send
MB64E_BUTTON_Send
call MB64E_MIDI_SendButtonEvent
;; request display update
bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ
;; reset the cursor of the CS
call CS_MENU_ResetCursor
MB64E_BUTTON_NotifyChangeEnd
return
First i cannot find the MB64E_LED_Set function
So if i understand well ..
A button is pressed …
We check if this is an CS button
Then map the button to the button number
Then this is the SFB implementation
Then the GP implementation :
Here we save the button number in MB64E_CURRENT_BUTTON
Check if this is the button is configured to a SFB
IF not this is a GP: “MB64E_BUTTON_GP_NoSFB”
If we are not in learn mode , we store current button value in TMP1
then check the behaviour of the button ( on-off, toggle …)
and then launch the MB64E_BUTTON_Send with some other thing before depending of the button behaviour …
Am i right ? I must understand well how it works to modify this …
If yes … do i just have to add something like that :
call MB64E_LED_Set
in the MB64E_BUTTON_Send handler ?
because, at this time, button pin number is still in WREG, and value in MIOS_PARAMETER1… no ???
i try several things like that without success…
To precise … i 'm a beginner in coding … but i’m starting to understand how it works …
thanx a lot for your help ! 
gilles