Christian,
Read the reply on the way out but didn’t have time to mess with it, so I tried at the studio and brought back an edited main.asm with the Rx/Tx lights working (I usually have them shut off in stuff I’m running). Unfortunately, I’ve gotten comfortable with asm and still have trouble with lots of areas, so I’d rather get that straight before trying to move into C. Therefore, I don’t know much about the combination when working with MIOS apps, but it sounds like you can use a little of each (?), so maybe these pieces of code can point you to some stuff you need.
This is all from the regular v1.9 assembler skeleton. There was only one minor addition outside the main file, and that was for the two (Rx/Tx) counters it uses. You’ll add that in the app_defines.h file. My test file was blank “variable-wise”, so it just went to the first couple free spots.
MIDI_RXTX_RX_CTR EQU 0x010
MIDI_RXTX_TX_CTR EQU 0x011
Next is the main. These are edited pastes from the MB64 files. It actually uses some stuff from the midi_rxtx.inc file, but I stuck the stuff directly into the places where it gets called, to keep it in one spot for clarity. Thorsten has all of the calls commented pretty well, so you should be able to see what it used to do by looking in the original MB64 files. Sorry to have hacked it up like that, but I thought it might make it easier to see what was needed for just a blank skeleton with Rx/Tx lights. These MB64 copy/pastes are also missing some conditional stuff and have some variables replaced with their actual data (in this particular app). The MB64 has lots of ways different people can set it up, and needs to act accordingly, but these edits assume that you want MIDI monitor lights, and that you’ll be using the first two DOUT pins for them. I’ll just paste the functions from main where I actually inserted anything:
USER_Init
;; define number of shift registers: for 128 IOs, we need
;; 16 registers. Btw.: thats the maximum number of supported DIN/DOUTs
movlw 3 ; I happened to only be using 3 SR's (24 buttons/lights)
call MIOS_SRIO_NumberSet
;; define the update frequency (latency) of DIN/DOUTs in mS
movlw 1 ; ms
call MIOS_SRIO_UpdateFrqSet
return
;;------------------------------------------------------------------------------
USER_MIDI_NotifyTx
movlw 15 ; there was a MIDI_RXTX_LED_DELAY variable here (#defined as 15ms)
SET_BSR MIDI_RXTX_TX_CTR
movwf MIDI_RXTX_TX_CTR, BANKED
return
;;------------------------------------------------------------------------------
USER_MIDI_NotifyRx
movlw 15 ; LED "on time" delay -same as above
SET_BSR MIDI_RXTX_RX_CTR
movwf MIDI_RXTX_RX_CTR, BANKED
return
Alright, then here’s a piece of my junk (not edited from MB64 source). It just spits out a C note on/off when the buttons get hit (so there will be some actual MIDI going out). Also goes in the main.asm:
USER_DIN_NotifyToggle
;; first it checks to see whether the toggle was pushed or unpushed
;; (button state is in MIOS_PARAMETER2)
IFCLR MIOS_PARAMETER2, 0, goto ON
OFF
call MIOS_MIDI_BeginStream
movlw 0x80
call MIOS_MIDI_TxBufferPut
movlw 0x3C
call MIOS_MIDI_TxBufferPut
movlw 0x7F
call MIOS_MIDI_TxBufferPut
call MIOS_MIDI_EndStream
return
ON
call MIOS_MIDI_BeginStream
movlw 0x90
call MIOS_MIDI_TxBufferPut
movlw 0x3C
call MIOS_MIDI_TxBufferPut
movlw 0x7F
call MIOS_MIDI_TxBufferPut
call MIOS_MIDI_EndStream
return
Last paste into main is this. This one is where the two actual DOUT numbers (0x00 and 0x01) replaced the MIDI_RXTX_RX_LED and MIDI_RXTX_TX_LED stuff:
USER_SR_Service_Prepare
;; Decrement Rx counter if != 0
SET_BSR MIDI_RXTX_RX_CTR
movf MIDI_RXTX_RX_CTR, W, BANKED
skpz
decf MIDI_RXTX_RX_CTR, F, BANKED
;; Decrement Tx counter if != 0
SET_BSR MIDI_RXTX_TX_CTR
movf MIDI_RXTX_TX_CTR, W, BANKED
skpz
decf MIDI_RXTX_TX_CTR, F, BANKED
;;
;; remove the code below if you don't want to use LEDs to
;; indicate the counter state
;;
;; set the Rx LED depending on counter state
SET_BSR MIDI_RXTX_RX_CTR
movf MIDI_RXTX_RX_CTR, W, BANKED
skpz
movlw 0x01
movwf MIOS_PARAMETER1
movlw 0x00 ;my dout pin for MIDI receive
call MIOS_DOUT_PinSet
;; set the Tx LED depending on counter state
SET_BSR MIDI_RXTX_TX_CTR
movf MIDI_RXTX_TX_CTR, W, BANKED
skpz
movlw 0x01
movwf MIOS_PARAMETER1
movlw 0x01 ;my dout pin for MIDI transmit
call MIOS_DOUT_PinSet
return
I hope some of that can help you figure out what may have been missing (and that you can use actual asm code in your skeleton 8) ). It dumped and worked OK at the studio, and on another box here.
Take Care,
George