Jump to content

Normally Open/Closed Question


goyousalukis
 Share

Recommended Posts

Hello everyone and happy new year!

I haven't posted for over a year, but I'm back on the midibox train. I have built a midibox 64 that I will use to trigger samples using foot pedals. I want to use cheap piano pedals that I already have. That being said, they are normally closed switches. I have already cracked one open and modified it to normally open, but I was wondering if there is an easy way to switch the button behaviour in MIOS for some of the buttons? If I have to, I'll modify them, but I'd rather leave them alone.

Thanks

Justin

Link to comment
Share on other sites

Hi Justin,

welcome back! :)

You only need to invert the button value at the beginning of the USER_DIN_NotifyToggle hook, this could be done with "comf MIOS_PARAMETER2, F" - if only a certain number of buttons should be inverted, you need to check the button number in MIOS_PARAMETER1 before

Best Regards, Thorsten.

Link to comment
Share on other sites

Hey TK,

Thanks for your quick reply. I did as you suggested and I think it works properly - I just wondered if you'd check my work in case I messed up in the ASM!

This is my USER_DIN_NotifyToggle

	movlw 	0x12 			;; load 18 into the WREG
	cpfsgt  MIOS_PARAMETER1		;; Compare the button num to 18 skip if it is > 18
	goto    MB64_BUTTON_Handler	;; if less than don't complement
	comf 	MIOS_PARAMETER2, F	;; if greater than complement
	goto	MB64_BUTTON_Handler	;;

I want to invert all the buttons greater than 18.

I was worried about the WREG - do I need to put the button number back in it after the compare?.

Sorry if my ASM is ugly - it's been a long time....

Thanks Justin

Link to comment
Share on other sites

Hi Justin,

do I need to put the button number back in it after the compare?

some applications require this (not sure if this is the case for MB64), so just add a "movf MIOS_PARAMETER1, W" before branching to the handler.

Sorry if my ASM is ugly - it's been a long time....

it looks very compact :)

Best Regards, Thorsten.

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