AndrewMartens Posted September 15, 2006 Report Share Posted September 15, 2006 I thought that I could puzzle this one out myself, but I'm having trouble determining how to access the CS_SID_FILTER_CHANNELS register directly. At this point I've been experimenting for about an hour (and I quickly perused the forums and wiki) but haven't figured this one out yet. And yes, I'm planning on documenting this modification in the wiki! ;DWhat I'm attempting to do is have a single button that cycles through the Filter Channels [123] and the external input. Cycling through the first three channels is the default behaviour, and I have my button mapped correctly so that's working. I can even figure out how to also set toggle the external input bit, that's not so bad either. The problem I'm having is trying to determine when the three filter channel bits are all set to 1, and then toggle the external bit.I assumed that (due to the cs_menu_led.inc) the relevant bits should be ANDLW'd with 0x0E first (ie, 0000123E), then I'm using the SUBLW to subtract for comparison. You can see where I'm trying to access the bits below, but I'm a bit confused how to get at the register directly without going through the whole menu structure. Ideally I'm planning on bypassing the menu setup entirely (should be easy once I've got the register address / map figured out). The following code is taken from my cs_menu_buttons.inc:[pre]CS_MENU_BUTTON_Fil_Sel ;; do nothing if button has been depressed IFSET MIOS_PARAMETER2, 0, return ;; check if the Filter setting is maxed out yet call CS_MENU_MS_GetSIDBase movlw 0x80 andwf FSR0L, F movlw CS_SID_FILTER_CHANNELS movf PLUSW0, W ; is that the right way to read the register? andlw 0x0E ; mask the CS_SID_FILTER_CHANNELS register sublw 0x0E ; subtract for comparison btfss STATUS, Z ; if zero bit is set, skip next line goto CS_MENU_BUTTON_Fil_Sel_2 ;; obviously the Filter setting is maxed out, so first ;; we want to toggle the EXT filter setting movlw 0x05 ; cursor pos movwf MIOS_PARAMETER1 movlw 0x00 ; page offset (maybe?) movwf MIOS_PARAMETER2 movlw CS_MENU_FIL ; menu structure call CS_MENU_ButtonToggle ; we're just turning EXT on or off ; and we're using a call because we ; want to return back here and then inc the filterCS_MENU_BUTTON_Fil_Sel_2 ;; else increment Filter setting movlw 0x00 ; cursor pos movwf MIOS_PARAMETER1 movlw 0x00 ; page offset movwf MIOS_PARAMETER2 movlw CS_MENU_FIL ; menu structure goto CS_MENU_ButtonInc[/pre]I don't need a full solution here for my plan, just a way to load up the CS_SID_FILTER_CHANNELS into W. I can take it from there... ;) Quote Link to comment Share on other sites More sharing options...
TK. Posted September 15, 2006 Report Share Posted September 15, 2006 I guess that the parameter handler behind CS_MENU_ButtonInc and CS_MENU_ButtonToggle will never switch to values > 0x7, since this would exceed the defined maximum value.I cannot tell you immediately how to enahnce your code so that it works for that what you want to do under all circumstances (e.g. + the optional CC parameter sent, etc...) - I can only write, how I would do this:- in cs_menu_tables.inc, search for "CS_SID_FILTER_CHANNELS" and set the max value to 0x0f (instead of 0x07)- in cs_menu_p2r_r2p.inc, search for CS_MENU_P2R_FILTER_CHN and CS_MENU_R2P_FILTER_CHN, duplicate the code (since it is used for *_MOD as well), and change the masks (replace 0xf8 by 0xf0 and 0x07 by 0x0f)This should be all (I haven't tried this...)Best Regards, Thorsten. Quote Link to comment Share on other sites More sharing options...
AndrewMartens Posted September 17, 2006 Author Report Share Posted September 17, 2006 Thanks, TK!I'm quite happy with it not sending CC at all - I'm just using it as a quick way to switch through the filter settings on it. As a simple way to enable the filter on [123E], it works great. I just removed all the code that I had written, and made the changes that you suggested. Then I added another change so that dedicated button presses restore the old menu settings afterwards - if I've got a button for it, I don't need it jumping into the menu. That was an easy matter of just commenting out three lines in cs_menu.inc.Now I just need to edit the text that I wrote, take some more pictures, and post it up on the Wiki sometime this week... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.