Hi there,
I have been inspired by the idea of MBSeq in a small box with not too much controls, 1 LCD and 8 encoders and some buttons and started working on a prototype. Due to parts I had, I started on a V2 seq, I had a “452” lying around ![]()
To implement a shift function this what I have done:
in app_defines.h change
;; free: 0x16b
to this:
SEQ_BUTTON_SHIFT_STATE EQU 0x16b ;; free: 0x16b
In seq_core.inc add this after the line with SEQ_MODE1_RECORD..
SEQ_BUTTON_NOSHIFT EQU 0 ; Shift buttons
SEQ_BUTTON_SHIFT EQU 1 ;
Ofcourse I added something like this to the setup*.asm (according to your own box)
DIN_ENTRY SEQ_BUTTON_Shift, 3, 7
in seq_buttons.inc I added this after the SEQ_BUTTON_All function
;; --------------------------------------------------------------------------
;; Enable to shift
;; --------------------------------------------------------------------------
SEQ_BUTTON_Shift
SET_BSR SEQ_BASE
#if DEFAULT_BEHAVIOUR_BUTTON_SHIFT
;; Toggle Mode (default):
;; exit if button depressed
btfsc MIOS_PARAMETER2, 0
return
;; else toggle status
btg SEQ_BUTTON_SHIFT_STATE, SEQ_BUTTON_SHIFT, BANKED
#else
;; On/Off Mode:
;; button status controls mode directly
bcf SEQ_BUTTON_SHIFT_STATE, SEQ_MODE_SHIFT, BANKED
btfss MIOS_PARAMETER2, 0
bsf SEQ_BUTTON_SHIFT_STATE, SEQ_MODE_NOSHIFT, BANKED
#endif
return
In seq_gp.inc in function SEQ_GP_function I added this (some lines repeated for the right line)
SEQ_GP_Button
;; request display update
bsf CS_STAT, CS_STAT_DISPLAY_UPDATE_REQ
;; the menu select function overlays everything
SET_BSR SEQ_BASE
BRA_IFSET SEQ_MODE0, SEQ_MODE0_MENU, BANKED, SEQ_GP_Mode4_Button
;; This is new: setting the gp no according to shift state: add 8 = setting bit 3
BRA_IFCLR SEQ_BUTTON_SHIFT_STATE, SEQ_BUTTON_SHIFT, BANKED, SEQ_GP_NoShift
bsf MIOS_PARAMETER1, 3
SEQ_GP_NoShift
up till now this is working
well almost. The shift key does the job on GP buttons but, you can only see it working after pushing one… Pointers anyone? From here things get worse. I tried to “copy” this to the encoder function, but it is going wrong. I know that you have to add 8 to WREG but I didn’t succeed in getting that working. The bit setting trick didn’t work. So any help is appreciated
SEQ_ENC_Handler
;; save encoder number in SEQ_CURRENT_STEP and SEQ_EVNTS
SET_BSR SEQ_BASE
;;new: Altered for shift function
BRA_IFCLR SEQ_BUTTON_SHIFT_STATE, SEQ_BUTTON_SHIFT, BANKED, SEQ_Enc_NoShift
;could be this
;bsf MIOS_PARAMETER1, 3
;or this?
addwf 8, 0, BANKED
movf MIOS_PARAMETER1, W
SEQ_Enc_NoShift
This last piece of programming drama (being a pro: this brings me back to my programming kindergarten years) triggers all of them, but: all encoders are shifted one position: first enc does second value…last encoder does first value. And subtracting one from W just crashed the app. Can anyone shine a beautiful light?
Cheers…