Jump to content

Recommended Posts

Posted

Hi TK,

I'm trying to learn to do this in ain_example3_v1_3. In its original coded form below, in the section "USER_AIN_NotifyChange", the pots are referenced to mios_tables.inc and for 64 pots table entry position 0x00 to 0x3f.

;; we read the entry from MIOS_MPROC_EVENT_TABLE
      ;; this has a big advantage: you can setup the "input" and "output"
      ;; events at one place!
      TABLE_ADDR MIOS_MPROC_EVENT_TABLE      ; this macro sets the base address      
      movf      AIN_POT_NUMBER, W            ; add pot offset (number *2) to TABLPTR
      mullw      2                        ; multiplicate with 2, result in PROD[LH]
      movf      PRODL, W
      addwf      TBLPTRL, F                  ; low-byte
      movf      PRODH, W
      addwfc      TBLPTRH, F                  ; high-byte (+carry bit on overrun)

      ;; for MIDIbox Link: notify begin of stream
      call      MIOS_MIDI_BeginStream

      ;; send first MIDI byte
      tblrd*+                        ; read first byte from table
      movf      TABLAT, W
      call      MIOS_MIDI_TxBufferPut      ; and send

      ;; send the second MIDI byte
      tblrd*+                        ; read second byte from table
      movf      TABLAT, W
      call      MIOS_MIDI_TxBufferPut      ; and send

      ;; send the third MIDI byte
      movf      INDF0, W            ; value from 0x00 to 0x7f
      call      MIOS_MIDI_TxBufferPut

      ;; for MIDIbox Link: notify end of stream
      call      MIOS_MIDI_EndStream

      ;; request a display update by setting DISPLAY_UPDATE_REQ,0
      ;; USER_DISPLAY_Tick polls this flag!
      bsf      DISPLAY_UPDATE_REQ, 0

      ;; thats all

How do i get the pots to reference for example to table entry positions 0x80 to 0xbf and still be able to get the soft takeover to function correctly for new pot positions.

Sorry to keep picking on your brains but i'm just so motivated by all the possibilities of MIOS that i want to learn as much as i am capable of to be able to customise my own setups.

Peace & thanks

Frank

Posted

Hi Frank,

nice to hear that MIOS motivates you to learn PIC programming :)

Is it enough info for you when I just describe how it works in principle?

You have to enlarge the AIN_ACTIVE_VALUES array to more than 64 entries. Currently it's located to 0xc0-0xff, but for more entries it's better to shift the base address to 0x100, so that up to 256 entries (0x100-0x1ff) can be accessed without much more programming effort.

Now you need to add something like a group offset to the pointer which addresses this array within USER_AIN_NotifyChange). The offset is 0x40 (64) for 4 groups (when 256 entries are available).

Example:

replace

        ;; prepare pointer 1 for active value entry
        lfsr    FSR1, AIN_ACTIVE_VALUES_BEGIN
        movf    AIN_POT_NUMBER, W
        addwf   FSR1L, F
        ;; now we can access the active value indirectly via INDF1
by
        ;; prepare pointer 1 for active value entry
        lfsr    FSR1, AIN_ACTIVE_VALUES_BEGIN
        movf    AIN_POT_NUMBER, W
        addwf   GROUP_OFFSET, W
        addwf   FSR1L, F
        ;; now we can access the active value indirectly via INDF1

The offset can be: 0x00, 0x40, 0x80, 0xc0 (if 64 pots are connected)

Example for 16 pots: 0x00, 0x10, 0x20, 0x30, ...

Second change: the USER_MPROC_NotifyFoundEvent has to go through 256 entries instead of only 64

Third change: you need to one or more buttons for changing the group offset

Thats all

Best Regards, Thorsten.

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...
×
×
  • Create New...