Midi problems

Started by guydb91 November 6, 2005
hi,

still new at BX-24...I am trying to send out MIDI data, using the
information I found here. Unfortunately, instead of sending out what I
intend to send out I send out a lot of nonsensical data on various
MIDI channels (program changes, now and then a 'note on', after touch,
etc...but mostly system resets). I tried 2 circuits, one with the
2n2222 and one without (which always worked fine with the basic stamp.
And yes, I a using com1 with the 'register.UBRR = 14' setting. any
suggestions as to what I may be doing wrong?

thanks.

guy


> ... I am using com1 with the 'register.UBRR = 14' setting.

Assuming your 2N2222 circuit is just a MIDI loop current switch, try
inverting the serial data to the 2222 base. Tom



guydb91 wrote:

> hi,
>
> still new at BX-24...I am trying to send out MIDI data, using the
> information I found here. Unfortunately, instead of sending out what I
> intend to send out I send out a lot of nonsensical data on various
> MIDI channels (program changes, now and then a 'note on', after touch,
> etc...but mostly system resets). I tried 2 circuits, one with the
> 2n2222 and one without (which always worked fine with the basic stamp.
> And yes, I a using com1 with the 'register.UBRR = 14' setting. any
> suggestions as to what I may be doing wrong?

I believe this has been discussed before. Midi runs at 31250 baud. As a
consequence to get an exact multiplier people have been running BasicX @
8MHz. Doing the math yields a UBRR value of exactly 15. With the regular
7.3728 MHz clock rate you only get 30720 baud which might be causing the
problem.

Mike


Thats interesting about changing the system clock crystal. Sorry I
missed the previous discussion on MIDI and the BX-24 but wouldn't
changing the x'tal also effect the regular serial communications
behaviour?

Don Lewis --- In basicx@basi..., Mike Perks <basicx@a...> wrote:
>
> guydb91 wrote:
>
> > hi,
> >
> > still new at BX-24...I am trying to send out MIDI data, using the
> > information I found here. Unfortunately, instead of sending out what I
> > intend to send out I send out a lot of nonsensical data on various
> > MIDI channels (program changes, now and then a 'note on', after touch,
> > etc...but mostly system resets). I tried 2 circuits, one with the
> > 2n2222 and one without (which always worked fine with the basic stamp.
> > And yes, I a using com1 with the 'register.UBRR = 14' setting. any
> > suggestions as to what I may be doing wrong?
>
> I believe this has been discussed before. Midi runs at 31250 baud. As a
> consequence to get an exact multiplier people have been running
BasicX @
> 8MHz. Doing the math yields a UBRR value of exactly 15. With the
regular
> 7.3728 MHz clock rate you only get 30720 baud which might be causing
the
> problem.
>
> Mike
>




--- In basicx@basi..., "Don Lewis" <djlewis@t...> wrote:
> ... wouldn't changing the x'tal also effect the regular serial
> communications behaviour?

Yes, along with everthing else that is dependent on the CPU clock:
all RTC functions
CountTransition
FreqOut
InputCapture
OutputCapture
PlaySound
PulseIn
PulseOut
RCTime
X10Cmd

Except for X10Cmd, you could make adjustments in how you call them
or how you interpret the data returned. The time-of-day aspect of
the RTC would be difficult to adapt.

The timing of other functions like ShiftIn, ShiftOut, Get1Wire, etc.
would also be affected but they would probably work fine.

Don



thanks for the replies....my conclusion so far is to stick to the
basic stamp (where it is very straightforwardly functional) for MIDI
applications...I'll dedicate the BX-24 to other applications - I'm not
too fond of switching Com1 between computer communication and
applications, it's too shaky.

Guy
--- In basicx@basi..., "Don Kinzer" <dkinzer@e...> wrote:
>
> --- In basicx@basi..., "Don Lewis" <djlewis@t...> wrote:
> > ... wouldn't changing the x'tal also effect the regular serial
> > communications behaviour?
>
> Yes, along with everthing else that is dependent on the CPU clock:
[]


> ... switching Com1 between computer communication and applications
[is] too shaky.

Nonsense. You have a simple communications problem that you have not
identified. Tom



I have been using the information contained at this site
http://tigoe.net/pcomp/code/archives/bx-24/000249.shtml for the BX-24.

My issues have been other than the baud rate and have been resolved
after finding 3 gremlins. The last one being: Between detecting a
Keyboard change and the Call to process the new data, the data could
have changed again resulting in a faulty call to:
PutQueue(OutComm,DataArray,ByteCount) with ByteCount=0. PutQueue does
not like a ByteCount of zero.

Writing the Keyboard data into a temporary variable then using that
variable for ALL subsequent processing fixed the problem. --- In basicx@basi..., "guydb91" <guydebievre@t...> wrote:
>
> thanks for the replies....my conclusion so far is to stick to the
> basic stamp (where it is very straightforwardly functional) for MIDI
> applications...I'll dedicate the BX-24 to other applications - I'm not
> too fond of switching Com1 between computer communication and
> applications, it's too shaky.
>
> Guy




guydb91 wrote:

> hi,
>
> still new at BX-24...I am trying to send out MIDI data, using the
> information I found here. Unfortunately, instead of sending out what I
> intend to send out I send out a lot of nonsensical data on various
> MIDI channels (program changes, now and then a 'note on', after touch,
> etc...but mostly system resets). I tried 2 circuits, one with the
> 2n2222 and one without (which always worked fine with the basic stamp.
> And yes, I a using com1 with the 'register.UBRR = 14' setting. any
> suggestions as to what I may be doing wrong?

It seems that people have got MIDI working using the standard clock
frequency and register.UBRR = 14.

As Tom says, it sounds like you have some minor bug in your code.

Aonther option for more flexible communications is to use COM1 for MIDI
and COM3 for host communications. You will need to hook up a MAX232 to
the two COM3 pins. An advantage here is that you can use one MAX232 for
both COM1 (program download) and COM3 (monitoring). I haven't tried this
before myself but it should work providing you write strings to the COM3
output buffer (don't use Debug.Print) and you have the monitoring
program default to 9600 baud (BasicX IDE defaults to 19200).

Mike