Yahoo Groups archive

SynthModules

Index last updated: 2026-04-28 23:14 UTC

Thread

Anyone interested in helping with interrupt MIDI output?

Anyone interested in helping with interrupt MIDI output?

2005-04-29 by djbrow54

My PSIM template code runs with timer interrupts and MIDI input
interrupts.  I've been trying to get MIDI outputs to run with
interrupts instead of polling.  After a couple of days of working
with the AtomPro I've come to the conclusion that the oninterrupt
command is not working for transmit buffer empty.

I've gotten all the buffer code working and I'm streaming CC
messages to my PAiA MIDI2CV by simply executing the transmitter
ISR code on 1 mS timer interrupts.  Since MIDI bytes are ~ 320 uS
this puts a ~680 uS pause between bytes.  At least I know my
code logic executes correctly.

I've measured the ISR routine and it's ~200 uS long which leads me
to believe MIDI output interrupts will never really work since over
60% of the available processing time between interrupts will be spent
in the ISR.

Perhaps leaving it as is with transmiting the data during the timer
interrupts would be best.  I've sent a support ticket into
BasicMicro.  We'll see what they say.  When I wrote the code for
my interrupt MIDI input the oninterrupt for serial input did not
function.  Perhaps they only corrected half ...

Anyone done any work with MIDI output or feel like playing around
with interrupt code?  Send me an email.

Dave

Re: Anyone interested in helping with interrupt MIDI output?

2005-05-06 by djbrow54

I've got no response from BasicMicro on their serial transmit
interrupts not working.

I have, however, modified my code for an interesting workaround.

I am using TimerA to generate 512 uS interrupts and using this
as my transmit interrupt.  In the routine to put a byte into a
buffer I enable the timerA interrupt.  In the interrupt service
routine I disable the timerA interrupt if the buffer is empty.
I've been able to get the interrupt service routine down to 150
uS so it's quite functional.

I now have my code running with
  interrupt driven midi-in using a 128 byte cyclic buffer
  midi-out using 512 uS interrupts using a 128 byte cyclic buffer
  timerW with 1 mS interrupts for various timekeeping processing

It's hard to believe that this processor will function with all
three interrupts simultaneously.  I know that I cannot stream midi
continuously since I receive at 320 uS and transmit at 512 uS but
I can adjust the buffer sizes and there is plenty of ram available.

The code is in my folder as "psim template (rev0.51).djb.bas".
If they ever get the transmit interrupts working it will be easy
to adjust the code.  These would also be great routines to rewrite
in assembly.

Dave

--- In SynthModules@yahoogroups.com, "djbrow54" <davebr@e...> wrote:
Show quoted textHide quoted text
> My PSIM template code runs with timer interrupts and MIDI input
> interrupts.  I've been trying to get MIDI outputs to run with
> interrupts instead of polling.  After a couple of days of working
> with the AtomPro I've come to the conclusion that the oninterrupt
> command is not working for transmit buffer empty.
> 
> I've gotten all the buffer code working and I'm streaming CC
> messages to my PAiA MIDI2CV by simply executing the transmitter
> ISR code on 1 mS timer interrupts.  Since MIDI bytes are ~ 320 uS
> this puts a ~680 uS pause between bytes.  At least I know my
> code logic executes correctly.
> 
> I've measured the ISR routine and it's ~200 uS long which leads me
> to believe MIDI output interrupts will never really work since over
> 60% of the available processing time between interrupts will be
> spentin the ISR.
> 
> Perhaps leaving it as is with transmiting the data during the timer
> interrupts would be best.  I've sent a support ticket into
> BasicMicro.  We'll see what they say.  When I wrote the code for
> my interrupt MIDI input the oninterrupt for serial input did not
> function.  Perhaps they only corrected half ...
> 
> Anyone done any work with MIDI output or feel like playing around
> with interrupt code?  Send me an email.
> 
> Dave

Re: Anyone interested in helping with interrupt MIDI output?

2005-05-15 by djbrow54

--- In SynthModules@yahoogroups.com, "djbrow54" <davebr@e...> wrote:
I spent some time on the phone with technical support at BasicMicro.
They were quite helpful and put me on the track of using some of
their serial commands which now work correctly in the latest
version.  I have updated my PSIM template code for full interrupt
functionality of MIDI input and output.  I have used major portions
of this code for another BasicAtomPro project and am successfully
merging MIDI data streams at high throughput. The serial drivers
are quite reliable.

I've uploaded my latest code "psim template (rev0.6).djb.bas" in
the "DJB programs" folder. This template now implements:
  interrupt or polled MIDI input and output
  1 mS timestamp routine
  speakjet drivers and hex output routines
  interrupt or polled analog input averaging (4 samples)
  lights, speakjet, and console debug support routines

Dave

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.