integrating 8*8 matrix button to seqV2

Hi,

someone can help me for that: i’m trying to implement the 8*8 matrix (sm simple v1)on a seq running on pic18f4620.

what i’ve already done:

i’ve keep the gp button (integated with encoders), and the matrix button simply call the appropriate track:

code at the end of sm_simple.inc: (the resulting buton number saved in mios_parameter3)

SM_NotifyToggle

;; MEMO: here you could also branch directly to USER_DIN_NotifyToggle in order

;; to emulate buttons which are connected on the common way to the shift registers

;; ->

goto SEQ_BUTTON_GP_Cont_Trk1

SEQ_BUTTON_GP_Cont_Trk1 is located in “seq_button.inc”:

code:

SEQ_BUTTON_GP_Cont_Trk1

   

movlw 16

CPFSLT MIOS_PARAMETER3

goto SEQ_BUTTON_GP_Cont_Trk2

      movwf  MIOS_PARAMETER3

      movlw      1 << 0            ; select first track

      movwf      SEQ_SELECTED_TRKS, BANKED

    goto    SEQ_GP_Button

     

SEQ_BUTTON_GP_Cont_Trk2

movlw 32

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk3     

      ;; for GP17..31

      movwf  MIOS_PARAMETER3

      movlw      1 << 1            ; select second track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk3

movlw 48

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk4

     

      ;; for GP32..47

        movwf  MIOS_PARAMETER3

      movlw      1 << 2            ; select third track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk4     

      ;; for GP48..63

        movwf  MIOS_PARAMETER3

      movlw      1 << 3            ; select forth track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

;; ------------------------------------------------------------

but when compiling, i obtain the error “overwritting previous adress content” a lot of times at lines 41,85,165 and 170 in “mios_table”…

Maybe you need to select the right PIC in the mios.h file?

Best Regards, Thorsten.

that’s done! and the right pic is selected for the assembler..

Maybe you’ve added something to mios_tables.inc, so that the tables don’t match into the small address space between 0x3082 and 0x327f anymore.

However, thanks to MIOS V1.9, these tables could now be located outside mios_tables.inc again (it was the only trick I found out to add some more code)

Especially with the PIC18F4620 there is no memory issue anymore, so … just put the DIN and DOUT tables into a new .inc file :slight_smile:

Best Regards, Thorsten.

i’m working with the original mios_table file ???

Did you include sm_simple.inc before or after mios_tables.inc?

Normaly it should be added at the end of main.asm (e.g. below the “reusable utility functions” comment) to avoid address conflicts

Best Regards, Thorsten.

:slight_smile: :slight_smile: :)solved!  :o :o :o

i will test with hardware tomorrow!

the file sm_simple was defined before mios_table…

thanks TK

and the compilation works for pic18F452 too!

niiiiiice :slight_smile:

We’re all watching you moxi :smiley:

the first progs doesn’t work at all…:-X

don’t keep it at example, for the while the buton trig step of different track ,but not the appr. ones…

i go back to work on this…

i’ve done that:

SEQ_BUTTON_GP_Cont_Trk1

   

movlw 8

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk2

;; for GP0..7

      movff  MIOS_PARAMETER3, MIOS_PARAMETER1

      movlw      1 << 0            ; select first track

      movwf      SEQ_SELECTED_TRKS, BANKED

    goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk2

movlw 16

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk1_2     

      ;; for GP8..15

    movlw 0x08

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

    movlw      1 << 1            ; select second track

    movwf      SEQ_SELECTED_TRKS, BANKED

    goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk3

movlw 24

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk4

     

      ;; for GP16..23

    movlw 16

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

   

      movlw      1 << 2            ; select third track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk4

movlw 32

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk1_2     

      ;; for GP24..32

    movlw 24

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

        movwf  MIOS_PARAMETER3

      movlw      1 << 3            ; select forth track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk1_2

   

movlw 40

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk2_2

;; for GP32..39

    movlw 24

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

      movlw      1 << 0            ; select first track

      movwf      SEQ_SELECTED_TRKS, BANKED

    goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk2_2

movlw 48

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk3_2     

      ;; for GP40..47

    movlw 32

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

      movlw      1 << 1            ; select second track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk3_2

movlw 56

CPFSLT MIOS_PARAMETER3, BANKED

goto SEQ_BUTTON_GP_Cont_Trk4_2

     

      ;; for GP48..55

    movlw 40

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

      movlw      1 << 2            ; select third track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

SEQ_BUTTON_GP_Cont_Trk4_2

   

      ;; for GP56..64

    movlw 48

SUBWF  MIOS_PARAMETER3, 1

movff  MIOS_PARAMETER3, MIOS_PARAMETER1

      movlw      1 << 3            ; select forth track

      movwf      SEQ_SELECTED_TRKS, BANKED

      goto    SEQ_GP_Button

but only the eight first butons work properly, other buttons trig step but not the right ones…

any suggestions?

too much complicate for me…i’ve connected the other butons and now only the first buton of the matrix work!!!..

You could build some debugging code into your modifications in order to debug this.

Simplest solution: just send a MIDI event which contains the button number and the value, e.g. B0 <button> <value>

But remember: MIOS_MIDI* will change the BSR, it has to be changed back to “SET_BSR SEQ_BASE” after the MIOS_MIDI_TxBufferPut functions have been called

Best Regards, Thorsten.

…sorry ,too much bugs i don’t understand (e.g. the first line always enable steps of the  selected tracks…the fourth buton of each row invert all the step…and not sure of the reliability of my matrix)… i will try with connecting directly the 64 buttons to individual pins…the code will be more simple

i’m a simple man…i don’t like complication…(as say the song)

thanks for your help…

If you want to keep it simple, then just write:

SM_NotifyToggle
;; button number (0x00..0x3f) in MIOS_PARAMETER1

;; the selected track is: MIOS_PARAMETER1[5:4]
swapf	MIOS_PARAMETER1, W
andlw	0x03
call	MIOS_HLP_GetBitORMask ; each track has a dedicated bit, use the OR mask pattern for conversion
iorlw	0xf0 ; (for track button hold detection bit 7-4 must be 0xf!)
SET_BSR	SEQ_BASE
movwf	SEQ_SELECTED_TRKS, BANKED

;; the GP button number is MIOS_PARAMETER1[3:0], we can mask this:
movlw	0x0f
andwf	MIOS_PARAMETER1, F

;; branch to GP button handler
goto	SEQ_GP_Button
[/code]









(I haven't tried this code, propably you need to debug a little)







Best Regards, Thorsten.

thank!

i’ve unmount the first half of my matrix and get success with buttons directly connected.

i go re-re-re-connect  ;D the second half of the matrix in order to test your code (with only 4 row of 8 buttons, but i suppose it will be suffisant to test it), so this brainstorm won’t be for nothing and i will publish here the code for the two options…

Don’t work at all for the while, nothing is happening when pushing matrix buton…

So, you haven’t built in the debug code like proposed above? (Sending MIDI events to display which button has been pressed…)

Without such informations (saying “nothing happens”) your comment is useless :wink:

Best Regards, Thorsten.

i’ve inserted the code from the sm_simple app to send note, before the code you give to me, but really nothing happens, no note and no step triggered..

i’ve done the same thing with my first bugged programmation and even if the wrong step are triggered, midi notes are outputed, but its the same note for all buttons: c#1…

So, the scan matrix sends MIDI events when you are running the example application sm_example1 stand alone, but it doesn’t work when you are using the sm_simple.inc inside the MBSEQ application?

Seems, that you forgot to insert the hooks into main.asm? (see the header of sm_simple.inc, examples can be found in the main.asm of sm_example1)

Best Regards, Thorsten.