Jump to content

Change modify DIN table on MBFM for button assignment


Echopraxia
 Share

Recommended Posts

Hello,

Can some one help me with changing the CS_MENU_DIN_TABLE for getting the row buttons on another DIN board. I can't get the interrupt service routine working and just want to use a second DIN board instead of going in to the DOUT for these buttons.

Here is the table

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_Esc,	 1,	 2


	DIN_ENTRY	CS_MENU_BUTTON_Sel1,	 1,	 3

	DIN_ENTRY	CS_MENU_BUTTON_Sel2,	 1,	 4

	DIN_ENTRY	CS_MENU_BUTTON_Sel3,	 1,	 5

	DIN_ENTRY	CS_MENU_BUTTON_Sel4,	 1,	 6

	DIN_ENTRY	CS_MENU_BUTTON_Sel5,	 1,	 7

	DIN_ENTRY	CS_MENU_BUTTON_Sel6,	 2,	 0

	DIN_ENTRY	CS_MENU_BUTTON_Sel7,	 2,	 1

	DIN_ENTRY	CS_MENU_BUTTON_Sel8,	 2,	 2

	DIN_ENTRY	CS_MENU_BUTTON_Cfg,	 2,	 3


	DIN_ENTRY	CS_MENU_BUTTON_InsOP1,	 2,      4

	DIN_ENTRY	CS_MENU_BUTTON_InsOP2,	 2,      5

	DIN_ENTRY	CS_MENU_BUTTON_InsOP3,	 2,      6

	DIN_ENTRY	CS_MENU_BUTTON_InsOP4,	 2,      7

	DIN_ENTRY	CS_MENU_BUTTON_InsOPSel, 3,	 0


	;; the M_Row[1234] buttons are handled from an interrupt service routine!

	DIN_ENTRY_EOT



; ==========================================================================

;  This short table lists the SR/pin numbers of the four

;  Matrix Row Select Buttons. 

;  Since these buttons are multiplexed (4 DOUT pins -> 1 DIN pin) to save

;  one DIN shift register, we have to define the DIN pin and 4 DOUT pins

;  which are connected to these buttons (see also schematic)

; ==========================================================================

DIO_M_COL_ENTRY MACRO sr0, pin0, sr1, pin1, sr2, pin2, sr3, pin3, sr4, pin4, sr5, pin5

	db	(pin0 + 8*(sr0-1)), (pin1 + 8*(sr1-1)), (pin2 + 8*(sr2-1)), (pin3 + 8*(sr3-1)), (pin4 + 8*(sr4-1)), (pin5 + 8*(sr5-1))

	ENDM


DIO_M_ROW_ENTRY MACRO sr_in, pin_in, sr0, pin0, sr1, pin1, sr2, pin2, sr3, pin3

	db	(pin_in + 8*(sr_in-1)), (pin0 + 8*(sr0-1)), (pin1 + 8*(sr1-1)), (pin2 + 8*(sr2-1)), (pin3 + 8*(sr3-1))

	ENDM


DIO_M_TABLE

	;; --> DIN <-- pins of the 6 column select buttons

	;;		 Col1 SR/Pin, Col2 SR/Pin,  Col3 SR/Pin,  Col4 SR/Pin,  Col5 SR/Pin,  Col6 SR/Pin

	DIO_M_COL_ENTRY  4, 2,        4, 3,         4, 4,         4, 5,         4, 6,         4, 7


	;; --> DOUT <-- pins of the 6 LED columns

	;;		 Col1 SR/Pin, Col2 SR/Pin,  Col3 SR/Pin,  Col4 SR/Pin,  Col5 SR/Pin,  Col6 SR/Pin

	DIO_M_COL_ENTRY  2, 6,        2, 7,         3, 0,         3, 1,         3, 2,         3, 3


	;; --> 1*DIN/4*DOUT <-- pins of the 4 row select buttons

	;;		 DIN SR/Pin,  Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

	DIO_M_ROW_ENTRY  3, 1,        2, 2,         2, 3,         2, 4,         2, 5



; ==========================================================================

;  The following table defines all available DOUT pins with the appr.

;  register and bit which is assigned to the pin

;  CS_MENU_LED_Update uses this table to update all LEDs

; 

;  The register name and bit number can be found on the left, 

;  the shift register and pin number on the right side.

;

;  SR/pin numbers:

;     SR =  1 for the first DOUT shift register

;     SR =  2 for the second DOUT shift register

;     ...

;     SR = 16 for the last DOUT shift register

;

;     Pin = 0 for the D7 output pin of the shift register

;     Pin = 1 for the D6 output pin of the shift register

;     ...

;     Pin = 7 for the last output pin (D0) of the shift register

;

;  Set the SR and pin number to 0 if a LED function should not be used

;

;  The table must end with DOUT_ENTRY_EOT!

; ==========================================================================


DOUT_ENTRY MACRO reg, bit, sr, pin

		dw	reg, bit | ((pin + 8*(sr-1)) << 8)

	ENDM


DOUT_ENTRY_EOT MACRO

	dw	0x0000, 0x0000

	ENDM


CS_MENU_DOUT_TABLE

	;;		Register and bit			SR#	Pin#	  Description

	DOUT_ENTRY	CS_MENU_SELECTED_INS_FLAGS, 0,		1,	0	; INS1 LED (Note: Pin #0 is the D7 output of first SR)

	DOUT_ENTRY	CS_MENU_SELECTED_INS_FLAGS, 1,		1,	1	; INS2 LED

	DOUT_ENTRY	CS_MENU_SELECTED_INS_FLAGS, 2,		1,	2	; INS3 LED

	DOUT_ENTRY	CS_MENU_SELECTED_INS_FLAGS, 3,		1,	3	; INS4 LED


	DOUT_ENTRY	CS_MENU_SELECTED_OP_FLAGS, 0,		1,	4	; OP1 LED

	DOUT_ENTRY	CS_MENU_SELECTED_OP_FLAGS, 1,		1,	5	; OP2 LED

	DOUT_ENTRY	CS_MENU_SELECTED_OP_FLAGS, 2,		1,	6	; OP3 LED

	DOUT_ENTRY	CS_MENU_SELECTED_OP_FLAGS, 3,		1,	7	; OP4 LED


	DOUT_ENTRY	TMP1, 0,				2,	0	; Instrument LED

	DOUT_ENTRY	TMP1, 1,				2,	1	; OP LED


	;; NOTE: the pins of the MIDI Rx/Tx LEDs are assigned at main.asm

	DOUT_ENTRY_EOT

Link to comment
Share on other sites

So I am looking at the DIO_M_ROW_ENTRY


        ;; --> 1*DIN/4*DOUT <-- pins of the 4 row select buttons

        ;;               DIN SR/Pin,  Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

        DIO_M_ROW_ENTRY  3, 1,        2, 2,         2, 3,         2, 4,         2, 5


What do I need to change to define only the 4 pins on a new DIN SR. I would do DIN SR 5 PIN 0,1,2,3. Do I just delete The ;; --> 1*DIN/4*DOUT <-- Column and also delete the first entry which was labeled DIN SR/Pin like this?
;; --> DIN <-- pins of the 4 row select buttons

	;;		 Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

	DIO_M_ROW_ENTRY  5, 0,         5, 1,         5, 2,         5, 3

Or do I add it to the first Din column below DIO_M_COL_ENTRY ?

Link to comment
Share on other sites

So I am looking at the DIO_M_ROW_ENTRY


        ;; --> 1*DIN/4*DOUT <-- pins of the 4 row select buttons

        ;;       		DIN SR/Pin,  Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

        DIO_M_ROW_ENTRY  3, 1,        2, 2, 		2, 3, 		2, 4, 		2, 5


What do I need to change to define only the 4 pins on a new DIN SR. I would do DIN SR 5 PIN 0,1,2,3. Do I just delete The ;; --> 1*DIN/4*DOUT <-- Column and also delete the first entry which was labeled DIN SR/Pin like this?
;; --> DIN <-- pins of the 4 row select buttons

	;;         Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

	DIO_M_ROW_ENTRY  5, 0, 		5, 1, 		5, 2, 		5, 3

Or do I add it to the first Din column below DIO_M_COL_ENTRY ?
As I understand your wishes, you need to change only DIN SR 3,1, to 5,0, (or to 5,1, or to 5,2, etc. ) The other : SR2 pins are DOUT pins

        ;; --> 1*DIN/4*DOUT <-- pins of the 4 row select buttons

        ;;       		DIN SR/Pin,  Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

        DIO_M_ROW_ENTRY  5, 0,        2, 2, 		2, 3, 		2, 4, 		2, 5


Edited by Janis1279
Link to comment
Share on other sites

As I understand your wishes, you need to change only DIN SR 3,1, to 5,0, (or to 5,1, or to 5,2, etc. )

The other : SR2 pins are DOUT pins


        ;; --> 1*DIN/4*DOUT <-- pins of the 4 row select buttons

        ;;       		DIN SR/Pin,  Row1 SR/Pin,  Row2 SR/Pin,  Row3 SR/Pin,  Row4 SR/Pin

        DIO_M_ROW_ENTRY  5, 0,        2, 2, 		2, 3, 		2, 4, 		2, 5


But the DIN SR/Pin only uses one button right? How do I get all 4 row buttons working? How do I assign Row 1 to DIN SR 5 Pin 0, Row 2 to DIN SR 5 Pin 1, Row 3 to DIN SR 5 Pin 2 and Row 4 to DIN SR 5 Pin 3?

Link to comment
Share on other sites

this isn't possible, as the button handler is tailored around the matrix handling. you would have to implement dedicated button handlers for each button function, but there isn't enough free memory in the firmware.

it's better and much easier to get your matrix issue fixed at hardware level.

best regards, thorsten.

p.s.: what do you mean with "can't get the interrupt service routine working"? did you already modify the firmware? if yes: why and where?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...