Right now the code responds only to a single midi channel. How could I change it to respond to ALL midi channels?
Instructions are given to conform the DOUT gates to 1ms triggers to use with drum modules (which is my purpose.) However, some of my modules respond to gates, not triggers (the CGS Cynare’s Sustain input.) How could I modify this code to exclude specific DOUT pins from the 1ms-reset?
Thanks for any help. :) I am trying to learn ASM, but the syntax is very foreign to me. Looking forward to C-based programming with the new core!!
Right now the code responds only to a single midi channel. How could I change it to respond to ALL midi channels?
Following lines:
movlw 0x90 ; check for Note On at channel #1
cpfseq MIOS_PARAMETER1, ACCESS
rgoto USER_MPROC_NRE_NoNoteChn1
[/code]
have to be replaced by:
[code]
movf MIOS\_PARAMETER1, W ; get status byte
andlw 0xf0 ; mask out MIDI channel
xorlw 0x90 ; check for Note On
bnz USER\_MPROC\_NRE\_NoNoteChn1 ; skip if not a Note On event (ignore wrong label name)
Instructions are given to conform the DOUT gates to 1ms triggers to use with drum modules (which is my purpose.) However, some of my modules respond to gates, not triggers (the CGS Cynare’s Sustain input.) How could I modify this code to exclude specific DOUT pins from the 1ms-reset?
I’d like (just for ease-of-setup purposes) to be able to have a table that will assign specific MIDI notes to specific DOUT pins, in case I want to change things up after I get everything wired up. (This is a custom Midibox CV application for a modular drum machine with over 30 drum voices.) But I will save that for when I can learn a bit more of the syntax, since it seems fairly straightforward.
Okay, for my own edification I’ve attempted to thoroughly comment each step of the code. I referred to the 18F452 datasheet to try to deduce the different instructions syntax. I also renamed some of the functions and now the DOUT pin number = MIDI note number. Can you guys let me know if I’m on the right track here? I had to guess in a couple places (couldn’t find skpz in the datasheet.) I also commented out the call to CV_MIDI because my current application uses DOUT only. (I’d eventually like to modify this to translate velocity information to AOUT for specific drum triggers.) This code compiles without errors.
USER_MPROC_NotifyReceivedEvent
;; BEGIN --- control DOUT pins via Note events at all channels
movf MIOS_PARAMETER1, W ;; get MIDI event type & channel number
andlw 0xf0 ;; ignore non-valid MIDI events & channels
xorlw 0x80 ;; check for Note Off
bnz USER_MPROC_NRE_NotNoteOff ;; skip if not a Note Off event
USER_MPROC_NRE_NoteOff ;; if the event is Note Off
bsf MIOS_PARAMETER1, 4 ;; midi event type changed to Note On
clrf MIOS_PARAMETER3 ;; set velocity = 0
USER_MPROC_NRE_NotNoteOff
movf MIOS_PARAMETER1, W ;; get MIDI event type & channel number
andlw 0xf0 ;; ignore non-valid MIDI events & channels
xorlw 0x90 ;; check for Note On
bnz USER_MPROC_NRE_NotNote ;; skip if not a Note On event
USER_MPROC_NRE_IsNote
movf MIOS_PARAMETER3, W ;; get MIDI velocity information
skpz ;; skip next instruction if velocity = 0
movlw 0x01 ;; set W = 1
movwf MIOS_PARAMETER1 ;; set MIOS_PARAMETER1 = W
movf MIOS_PARAMETER2, W ;; get MIDI note value
andlw 0x7f ;; ignore non-valid note values
call MIOS_DOUT_PinSet ;; pin = note number, value = MIOS_PARAMETER1
USER_MPROC_NRE_NotNote
;; END --- control DOUT pins via Note events at all channels
;; process MIDI event
;; call CV_MIDI_NotifyReceivedEvent
;; for best latency: branch to USER_Tick so that the new CV values
;; will be mapped immediately
rgoto USER_Tick
Thanks very much for the info, I’ll check that out.
I tested the above code and it works, except I’m still having the same problem with the DOUTs as described above. I am guessing I’m missing something somewhere, where I need to tell MIOS how many shift registers are connected… or maybe there’s still something I overlooked with the shift register connections. I tried new 595s and that didn’t help. I’ll do some more double-checking tonight. Any help is appreciated!