Jump to content

BLM Driver with 8 columns??


Dusentrieb
 Share

Recommended Posts

Hi all,

Does somebody knows if its possible to change the Blm driver to drive a 16*8 (16 rows and 8 columns) button/led matrix instead a 16*4 button/led matrix ??

I tried to change the blm.inc but my assambler skills are very less.

I think I have to change some in this part of blm.inc to drive all 8 SR outputs as cathode (columns).


_BLM_PrepareCol ; (for C)

BLM_PrepareCol

	;; increment column

	SET_BSR	blm_selected_column

	incf	blm_selected_column, F, BANKED

	bcf	blm_selected_column, 2, BANKED	; wrap at 4         <--- when im change the 2 into 0, 1 or 3 the voltage on the cathode outputs changes. WHY? What does this line?? 


	;; select next DOUT/DIN column

	movf	blm_selected_column, W, BANKED	; (* see note below)

	call	MIOS_HLP_GetBitANDMask	; (inverted 1 of 8 code)

	andlw	0x0f                                                  <--- Is this the matrix lenght. In this case 16 ???

	movwf	MIOS_PARAMETER1


	;; duplicate the 4 selection lines for button matrix   <-----  I want to cycle 8 Outputs instead 4 duplicated outputs

   swapf	WREG, W

   iorwf	MIOS_PARAMETER1, W


	;; finally apply inversion mask (required when sink drivers are connected to cathode lines)

	xorlw	BLM_CATHODES_INV_MASK

	movwf	MIOS_PARAMETER1


	;; output on CATHODES* registers

#if BLM_DOUT_CATHODES1

	movlw	BLM_DOUT_CATHODES1 - 1

	call	MIOS_DOUT_SRSet

#endif

#if BLM_DOUT_CATHODES2

	movlw	BLM_DOUT_CATHODES2 - 1

	call	MIOS_DOUT_SRSet

#endif


	;; store row*2 offset in IRQ_TMP1 to simplify the addressing of blm_row_green and blm_row_red array   <--- Could somebody explain??

	SET_BSR	blm_selected_column

	movf	blm_selected_column, W, BANKED

	rlf	WREG, W

	andlw	0x06

	movwf	IRQ_TMP1

Could somebody help me??

PS: sorry for my less english skills. I hope you can understand what im mean.

DUsentrieb

Link to comment
Share on other sites


_BLM_PrepareCol ; (for C)
BLM_PrepareCol
;; increment column
SET_BSR blm_selected_column
incf blm_selected_column, F, BANKED
bcf blm_selected_column, 3, BANKED ; wrap at 8

;; select next DOUT/DIN column
movf blm_selected_column, W, BANKED
call MIOS_HLP_GetBitANDMask ; (inverted 1 of 8 code)

;; finally apply inversion mask (required when sink drivers are connected to cathode lines)
xorlw BLM_CATHODES_INV_MASK
movwf MIOS_PARAMETER1

;; output on CATHODES* registers
#if BLM_DOUT_CATHODES1
movlw BLM_DOUT_CATHODES1 - 1
call MIOS_DOUT_SRSet
#endif
#if BLM_DOUT_CATHODES2
movlw BLM_DOUT_CATHODES2 - 1
call MIOS_DOUT_SRSet
#endif

;; store row*2 offset in IRQ_TMP1 to simplify the addressing of blm_row_green and blm_row_red array
SET_BSR blm_selected_column
movf blm_selected_column, W, BANKED
rlf WREG, W
andlw 0x0e
movwf IRQ_TMP1
[/code] You also have to adjust the array sizes:
[code]
#if _BLM_NO_DEBOUNCING == 0
_blm_button_debounce_delay res 1
blm_button_debounce_ctr res 128
#endif

blm_selected_column res 1
blm_button_column_ctr res 1

blm_button_row_values res 16
blm_button_row_changed res 16

_blm_row_green res 16
_blm_row_red res 16

If assembler looks like voodoo for you, just have a look into the appr. MIOS32 implementations:

BLM:

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fblm%2F

and a more generic BLM driver provided by This (it also supports your 16x8 configuration):

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fblm_x%2F

The upcoming BLM_SCALAR firmware (for PIC and STM32) will provide 16x8 and 16x16 duo LEDs. So, if you don't manage to adapt the current BLM driver, just wait for the updates.

Best Regards, Thorsten.

Link to comment
Share on other sites


_BLM_PrepareCol ; (for C)

BLM_PrepareCol

        ;; increment column

        SET_BSR blm_selected_column

        incf    blm_selected_column, F, BANKED

        bcf     blm_selected_column, 3, BANKED  ; wrap at 8


        ;; select next DOUT/DIN column

        movf    blm_selected_column, W, BANKED

        call    MIOS_HLP_GetBitANDMask  ; (inverted 1 of 8 code)


        ;; finally apply inversion mask (required when sink drivers are connected to cathode lines)

        xorlw   BLM_CATHODES_INV_MASK

        movwf   MIOS_PARAMETER1


        ;; output on CATHODES* registers

#if BLM_DOUT_CATHODES1

        movlw   BLM_DOUT_CATHODES1 - 1

        call    MIOS_DOUT_SRSet

#endif

#if BLM_DOUT_CATHODES2

        movlw   BLM_DOUT_CATHODES2 - 1

        call    MIOS_DOUT_SRSet

#endif


        ;; store row*2 offset in IRQ_TMP1 to simplify the addressing of blm_row_green and blm_row_red array

        SET_BSR blm_selected_column

        movf    blm_selected_column, W, BANKED

        rlf     WREG, W

        andlw   0x0e

        movwf   IRQ_TMP1

You also have to adjust the array sizes:

#if _BLM_NO_DEBOUNCING == 0

_blm_button_debounce_delay res  1

blm_button_debounce_ctr res     128

#endif


blm_selected_column     res     1

blm_button_column_ctr   res     1


blm_button_row_values   res     16

blm_button_row_changed  res     16


_blm_row_green          res     16

_blm_row_red            res     16

If assembler looks like voodoo for you, just have a look into the appr. MIOS32 implementations:

BLM:

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fblm%2F

and a more generic BLM driver provided by This (it also supports your 16x8 configuration):

http://svnmios.midibox.org/listing.php?repname=svn.mios32&path=%2Ftrunk%2Fmodules%2Fblm_x%2F

The upcoming BLM_SCALAR firmware (for PIC and STM32) will provide 16x8 and 16x16 duo LEDs. So, if you don't manage to adapt the current BLM driver, just wait for the updates.

Best Regards, Thorsten.

Thank you for your quick answere Thorsten.

I have tested it with a 8*8 matrix and its work fine.

You are my hero.

and thanks for you awesome Midiboxproject.

"I love Midiboxing!!"

dUsentrieb

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