Jump to content

Howto: 10 encoders for menu items MBsid


OnAcid
 Share

Recommended Posts

Hello,

I'm bulding a quad MBsid based on Seppoman's "Der Brat 1000" design. This design incorporates 10 encoders beneath the LCD for changing menu values. I found the code below and this works perfectly for 5 menu encoders. The problem is, I can't have it get to work for 10 encoders. There must be something going on with all the different assign layers or something. ??? 

Maybe Somebody  can give me a code hint or example?

Thanks in advance.

----------------------------------------------------------------------------------------

st es möglich, statt der einzelnen anwähltaster auch gleich alps enlosregler zu verbauen...  so dass man jeden erscheinenden wert gleich mit dem endlosregler unter dem display (2x20) verändern kann....

Jein. Das mit den Endlosreglern klappt so wie Du es beschrieben hast, hierzu musst Du lediglich in cs_menu_enc_table.inc folgenden Code:

CS_MENU_ENC_TABLE
        ;; OSC "Env" Layer
        ;;              Function name           parameter                 menu          offset  cursor pos
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_DELAY,      CS_MENU_OSC,  0x03,   0x03
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_ATTACK,     CS_MENU_OSC,  0x03,   0x04
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_DECAY,      CS_MENU_OSC,  0x03,   0x05
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_SUSTAIN,    CS_MENU_OSC,  0x03,   0x06
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_RELEASE,    CS_MENU_OSC,  0x03,   0x07
ersetzen durch:
CS_MENU_ENC_TABLE
        ;; Env "Assign" Layer
        ;;              Function name           parameter                 menu          offset  cursor pos
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_MENU_P1, 0x00,                 0x00,         0x00,   0x00
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_MENU_P2, 0x00,                 0x00,         0x00,   0x00
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_MENU_P3, 0x00,                 0x00,         0x00,   0x00
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_MENU_P4, 0x00,                 0x00,         0x00,   0x00
        CSENC_ENTRY     CS_MENU_ENC_CHANGE_MENU_P5, 0x00,                 0x00,         0x00,   0x00

Doch die Selektierungstaster sowie das Datawheel werden auch weiterhin notwendig sein, es gibt einige Untermenues (wie bspw. das "Edit Name" menue), in der sie gebraucht werden.

Gruss,

        Thorsten.

Link to comment
Share on other sites

Hi Sebastian,

have a look at the firmware I sent you :)

The encoder functions are defined in cs_menu_enc_table.inc - there you can find the following section:

	;; Env "Assign2" Layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P6, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P7, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P8, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P9, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P10, 0x00,		  0x00,		0x00,	0x00

	;; Env  "Fun" Layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_SYS, CS_SID_WAVETABLE_RATE,	  CS_MENU_WT,	0x00,	0x05 ; WT Speed
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_LFO, CS_SID_LFOx_DEPTH,	  CS_MENU_LFO,	0x00,	0x03 ; LFO Amount
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_LFO, CS_SID_LFOx_RATE,	  CS_MENU_LFO,	0x00,	0x02 ; LFO Speed
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_ATTACK,	  CS_MENU_OSC,	0x03,	0x04 ; VCA Attack
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_OSC, CS_SID_VOICEx_RELEASE,	  CS_MENU_OSC,	0x03,	0x07 ; VCA Release
I "misused" the original "Env" Encoder section for the second 5 encoders. First there´s the 6-10 menu values, then there´s the second half of the "Fun layer". Both the OSC enoders and the ENV encoders are switched at the same time by the Fun Layer button. I reduced the layers of both to 2. If you want to have more layers, you could add at least one more by simply removing some of my modifications. The switching of the two layers is done in cs_menu_buttons.inc with the following routine:
CS_MENU_BUTTON_Osc_Ctrl
	;; do nothing if button has been depressed
	IFSET	MIOS_PARAMETER2, 0, return
	;; increment OSC Ctrl parameter (0x00-0x01)
	incf	CS_MENU_SELECTED_OSC_CTRL, F
	movlw	0x01+1
	IFGEQ	CS_MENU_SELECTED_OSC_CTRL, ACCESS, clrf CS_MENU_SELECTED_OSC_CTRL

	;; increment ENV Ctrl parameter (0x00-0x01)
	incf	CS_MENU_SELECTED_ENV_CTRL, F
	movlw	0x01+1
	IFGEQ	CS_MENU_SELECTED_ENV_CTRL, ACCESS, clrf CS_MENU_SELECTED_ENV_CTRL

	goto	CS_MENU_LED_Update

Hope this helps :)

Seppoman

Link to comment
Share on other sites

Seppoman,

I'm already working on ver 1.7a, so your solution doens't seem to work (right out of the box ;)).

I also don't want to implement a "assign layer" yet. The first thing I want to have working are 10 standard menu encoders. After that, step 2 will be one or two assign layers for the encoders.

If I change the following code in cs_menu_enc_table.inc and cs_menu_enc.inc the encoders seem to work for 98%. ;)

cs_menu_enc_table.inc:

	;; Env  "Assign" Layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P1, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P2, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P3, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P4, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P5, 0x00,		  0x00,		0x00,	0x00

and at the end:

	;; Env "Env" Layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P6, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P7, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P8, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P9, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P10, 0x00,		  0x00,		0x00,	0x00

and in cs_menu_enc.inc:

CS_MENU_ENC_CS_Env
	movf	MIOS_PARAMETER1, W
	addlw	0x13-0x09
	IFSET	CS_MENU_SELECTED_ENV_CTRL, 0, addlw 0x05
	;; 	rgoto	CS_MENU_ENC_CS_Cont
the first 5 encoders work perfectly now, but the 6th encoder changes the value of menu item 7, encoder 7 changes menu item 8 and so on.  And the last encoder (10) changes the value of menu item 5!  ??? Anyway, the real problem is that I just can't understand the logic behind the cs_menu_enc.inc file. I know the encoder table is some sort of array, but I just don't get it. For instance, where are all the offsets for? I would really like to make a simple table in cs_menu_enc_table.inc with something like the following code:
CS_MENU_ENC_TABLE
	;; Standard menu layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P1, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P2, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P3, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P4, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P5, 0x00,		  0x00,		0x00,	0x00
        CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P6, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P7, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P8, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P9, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P10, 0x00,		  0x00,		0x00,	0x00

	;; Assign layer 1
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_SYS, CS_SID_FILTER_CUTOFF,	  CS_MENU_FIL,	0x00,	0x01
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_SYS, CS_SID_FILTER_RESONANCE,  CS_MENU_FIL,	0x00,	0x02
	ETC...

Well, maybe a good night sleep will benefit me... ;D

Link to comment
Share on other sites

Hi Sebastian,

of course it´s more elegant to have only the lines in the table that are relevant, but If you just want to have the 10 menu encoders running for now, you don´t need to change anything in the cs_menu_enc.inc. my changes there are just because of the 2 instead of 3 layers. Just modify the original table, nothing else as a first step.

The cs_menu_inc_table is a table where the lines have to be in a defined order if you don´t change anything else. So for only menu encoder function it would be the most simple solution to use the standard firmware and just replace the first five entries of the OSC and ENV entries with the Change_menu... functions. If the display positions are then still rotated, it could perhaps be a small bug in the 1.7 firmware. the P6...P10 functions are not used in Thorsten´s CS so perhaps some small error slipped in unnoticed. So first try this with the standard firmware and only change the P1..P5 in the Env Assign layer to P6..P10. Then we know if it´s Thorsten´s or your bug (or mine if you used anything else from me so far ;) )

Offsets: Do you mean the numbers in the CS_MENU_ENC routines or the offset column in the table? In the table, there are just definitions about which segment of the menu should be shown. When you set Offset 0x02, the first visible value will be the third one of a certain menu, and Cursor pos selects which of the visible values is selected. For the change_menu_Px function, these are always 0 because you don´t want the cursor to jump away if you change a value on the display :)

Seppoman

Link to comment
Share on other sites

I've got the first step, 10 menu encoders,  working.  :D

	;; OSC "Env" Layer
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P1, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P2, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P3, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P4, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P5, 0x00,		  0x00,		0x00,	0x00

and 

	;; LFO section
	;;		Function name		parameter		  menu		offset	cursor pos
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P6, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P7, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P8, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P9, 0x00,		  0x00,		0x00,	0x00
	CSENC_ENTRY	CS_MENU_ENC_CHANGE_MENU_P10, 0x00,		  0x00,		0x00,	0x00

Orginally the LFO section only contained two functions (encoder 6,7). After that came the Filter section with two more functions (encoder 8,9) and the last encoder had to be placed in Env "env" layer. But putting al five encoders (6-10) in the LFO section also worked. (Which I already thought after checking cs_menu_enc_inc. :))

I'm happy!

Next things on my list are (in random order):

  • One or two encoder "assign layers".
  • Leds for the selected menu items (OSC, ENV, FIL, etc...).
  • Have the save menu work with the encoders (enter button?).
  • Check the new "303 engine" and the AOUT option before sending my panel to Schaeffer. ;)

Thanks for your time and help.

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...