Reply by wurlitzer28 January 3, 20062006-01-03

> The required divisor is proprotional to the CPU clock frequency.
> Since the clock frequency of the P version is the same, the divisor
is
> also the same.
>
> The formula for the divisor for all AVR processors that I have seen is
> N = (Freq / 16 / Baud) - 1. Plugging in 7.37MHz for Freq and 31250
> for Baud yields 13.7. The actual baud when using a divisor of 14
will
> be 30,720 which is about 1.7% low.
>
Thanks Don, that's good to know!
Craig


Reply by Don Kinzer January 3, 20062006-01-03
--- In basicx@basi..., "wurlitzer28" <craig.whitley@a...>
wrote:
>[...] By the way does the BX-24P still use "14" for the baud rate
> divisor to generate something close to MIDI.

The required divisor is proprotional to the CPU clock frequency.
Since the clock frequency of the P version is the same, the divisor is
also the same.

The formula for the divisor for all AVR processors that I have seen is
N = (Freq / 16 / Baud) - 1. Plugging in 7.37MHz for Freq and 31250
for Baud yields 13.7. The actual baud when using a divisor of 14 will
be 30,720 which is about 1.7% low.


Reply by wurlitzer28 January 3, 20062006-01-03
--- In basicx@basi..., "Tom Becker" <gtbecker@r...> wrote:
>
> > ... I think that will make a rather low cost baud rate
converter...
>
> Cheaper than using a MAX3100 or similar SPI UART running at 2MHz/4?
> Why not offload MIDI timing and completely free up COM1? > Tom
>
Tom, thanks for your input. As I do have a spare BX-24 it is cheaper
for this one time only application although I would still like to
force the laptop (or other PC) to use it's RS232 port at 31,250 baud.
Your alternative hardware choices are sound and if I do not use the
BX-24 I may go that route.

By the way does the BX-24P still use "14" for the baud rate divisor
to generate something close to MIDI.

The current BX-24 does the following in 5 different modes:
Manual Play(organ pipes only)
Manual Play (Pipes & MIDI to a MIDI equipped keyboard)
Manual Play (MIDI only)
Record (in a proprietary higher speed format than MIDI)
Auto-Playback (in proprietary high speed format and maybe MIDI in the
future)

Functions: Scan 4 Keyboards (61 notes each)
Scan 1 Pedal board with 1st and 2nd touch (32 notes each)
Scan 91 stop tabs
Scan Swell pedal (volume control)
Scan 22 Combination Action Pistons
Provide clock, strobe, data for 97 counts to update pipe
drivers.
Xmit MIDI or High Speed data to Electronic Keyboard or PC. If there are changes in above scan from the last scan the BX-24
outputs in either MIDI or proprietary high speed format. Because of
all this scanning, it would not be practical to off load the MIDI
xmit function as it is processed very quickly because of the way the
inputs are scanned and that data is presented to the MIDI Xmit
routine in a very concise manner.

As you can see, I have the BX-24 loaded and it is doing a ton of
processing in a very efficient manner. All the data listed above are
brought into PortA as an 8 bit word so a single read gives me 8
inputs that can be compared with the last read as a single word.
PortC outputs Clock, Data, Strobe and input for mode selector switch

Right now the BX-24 is doing all the above at a complete
scan/update/Xmit any changes at a rate of 75 times/second.

I am getting a few requests to market this device (very limited
number of people have pipe organs) and a sound hardware solution may
be in my best interest should I try to sell this.


Reply by Tom Becker January 2, 20062006-01-02
> ... I think that will make a rather low cost baud rate converter...

Cheaper than using a MAX3100 or similar SPI UART running at 2MHz/4?
Why not offload MIDI timing and completely free up COM1? Tom


Reply by wurlitzer28 January 2, 20062006-01-02
--- In basicx@basi..., "Sloan Thrasher" <sloan@s...> wrote:
>
> Why not use the MIDI input on your PC?
>

Sloan!

My laptop only has a conventional RS232 port and its associated
driver will not allow my VB's WinAPI call to change the baud rate to
31,250 because the driver does not support that rate. Most
PCs/laptops do not have a MIDI input port. Most PCs handle the MIDI
communication via the game/joystick card port.

MIDI is a great protocol in that it has survived the test of time and
is still going strong. Unfortunately some dip stick, back on MIDI day
one, decided to use this non-standard baud rate.

If I cannot force my laptop to use the non-standard baud rate I may
just use another BX-24 with Comm1=MIDI rate and Comm28,400 baud and
just stay in a tight main loop looking for data in comm2 and sending
any found out comm1. I think that will make a rather low cost baud
rate converter.



Reply by Sloan Thrasher January 2, 20062006-01-02
Why not use the MIDI input on your PC?

----- Original Message -----
From: "wurlitzer28" <craig.whitley@crai...>
To: <basicx@basi...>
Sent: Monday, January 02, 2006 8:02 AM
Subject: [BasicX] Baud Rate Question > I have a BX-24 running a pipe organ scanning routine and one of its
> modes is to output data in MIDI format which requires a baud rate of
> 31,250 and setting Register.UBRR = 14 works perfect.
>
> However, I would like to communicate with the BX-24 over the hardware
> Comm1 from my laptop. My laptop does not support the MIDI baud rate and
> I event tried a VB/Win API to change the laptop's baud rate to the
> standard MIDI rate but I received a "Driver does not support this baud
> rate" error.




Reply by wurlitzer28 January 2, 20062006-01-02
I have a BX-24 running a pipe organ scanning routine and one of its
modes is to output data in MIDI format which requires a baud rate of
31,250 and setting Register.UBRR = 14 works perfect.

However, I would like to communicate with the BX-24 over the hardware
Comm1 from my laptop. My laptop does not support the MIDI baud rate and
I event tried a VB/Win API to change the laptop's baud rate to the
standard MIDI rate but I received a "Driver does not support this baud
rate" error.

My goal is to have comm1 TX on the BX-24 sending data out to the MIDI
device and listening on Comm1 RX for data from the PC/laptop.

The BX-24 processor is doing a bunch of stuff so adding a software
comm2 is not a viable option. Has anyone played with changing a PCs serial port driver to allow a non-
standard rate?