Sign in

username:

password:



Not a member?

Search basicx



Search tips

Subscribe to basicx



basicx by Keywords

Accelerometer | ADC | ADXL | Adxl20 | AVR | BasicStamp | BX-35 | BX28 | BX35 | COM3 | Compiler | Downloader | EEPROM | Electromagnet | GetADC | GP2D1 | GPS | I2C | IDE | Keypad | LCD | LCD+ | MIDI | Motors | Multitasking | Netmedia | Networking | PCB | PID | PlaySound | PWM | Relays | RTC | Servo | ShiftOut | SitePlayer | SPI | Stack | Timer | USB

Ads

Discussion Groups

Discussion Groups | BasicX | BX-24 and MIDI

Discussion forum for the BasicX family of microcontroller chips.

BX-24 and MIDI - Tom Igoe - Jun 20 17:29:00 2000

There was discussion of the BX-24 and MIDI a few weeks ago, and it
was mentioned that a different crystal would be needed to do MIDI.
What crystal was it, specifically? And would it affect the ADC's
horribly to change the crystal? I'm thinking of a couple apps that
would take digital and/or analog inputs and output MIDI.
--
--
Tom Igoe






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )


Re: BX-24 and MIDI - Jack Schoof - Jun 20 21:47:00 2000

A 8mhz crystal should be able to give you the correct baud rate.

You will have to calculate the baud rate and place it in the ubrr register
yourself.

You can do the opencom(1...) and then after this call, change the baud rate
yourself to the new value by doing a:

register.ubrr = 15

The calculation is ( (megahertz/16)/31250 ) - 1

Assuming the 31250 is the correct baud rate for the MIDI port (which I think
it is).

This ONLY works for COM1

Jack

-----Original Message-----
From: Tom Igoe <>
To: <>
Date: Tuesday, June 20, 2000 3:29 PM
Subject: [BasicX] BX-24 and MIDI >There was discussion of the BX-24 and MIDI a few weeks ago, and it
>was mentioned that a different crystal would be needed to do MIDI.
>What crystal was it, specifically? And would it affect the ADC's
>horribly to change the crystal? I'm thinking of a couple apps that
>would take digital and/or analog inputs and output MIDI.
>--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>Failed tests, classes skipped, forgotten locker combinations.
>Remember the good 'ol days
>http://click.egroups.com/1/5531/7/_/565855/_/961540185/
>------------------------------------------------------------------------






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Tom Igoe - Jun 21 8:16:00 2000

Thanks, Jack. Two follow-up questions:

1. is there any way to do it for com3?

2. Does this screw up the serial programming on com1? >A 8mhz crystal should be able to give you the correct baud rate.
>
>You will have to calculate the baud rate and place it in the ubrr register
>yourself.
>
>You can do the opencom(1...) and then after this call, change the baud rate
>yourself to the new value by doing a:
>
>register.ubrr = 15
>
>The calculation is ( (megahertz/16)/31250 ) - 1
>
>Assuming the 31250 is the correct baud rate for the MIDI port (which I think
>it is).
>
>This ONLY works for COM1
>
>Jack --
--
Tom Igoe





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Jack Schoof - Jun 21 10:11:00 2000

COM3 is bit banged using an interrupt at 4 times the baud rate. So for the
31250 this would be 125,000 interrupts per second. This is much higher than
we would like on COM3 and would reduce the processor to little to no
foreground processing.

As for COM1, it will change the 115,200 for downloading up to 125,000 I
dont think that the PC can handle this much change. I think it might be
better to use 2 crystals and a tiny switch while you are developing and then
when your project is done, then you can change it back.

The other option is to buy a cheap serial card, and change ITS xtal or
oscillator. Many of these us a 7.3728Mhz crystal or a 1.8432 crystal. You
can change this to a 8mhz or 2mhz crystal and you would be running at
125,000 baud too! This would allow you to download and debug at the same
speed.

Jack

-----Original Message-----
From: Tom Igoe <>
To: <>
Date: Wednesday, June 21, 2000 6:16 AM
Subject: Re: [BasicX] BX-24 and MIDI >Thanks, Jack. Two follow-up questions:
>
>1. is there any way to do it for com3?
>
>2. Does this screw up the serial programming on com1? >>A 8mhz crystal should be able to give you the correct baud rate.
>>
>>You will have to calculate the baud rate and place it in the ubrr register
>>yourself.
>>
>>You can do the opencom(1...) and then after this call, change the baud
rate
>>yourself to the new value by doing a:
>>
>>register.ubrr = 15
>>
>>The calculation is ( (megahertz/16)/31250 ) - 1
>>
>>Assuming the 31250 is the correct baud rate for the MIDI port (which I
think
>>it is).
>>
>>This ONLY works for COM1
>>
>>Jack >--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>仲間とはじめる、仲間を見つける eグループ
>   「グループメールしませんか?」
>サークル・同窓会・同僚・ビジネス・家族でどうぞ!
> http://www.egroups.co.jp/info/features.html
>http://click.egroups.com/1/3411/8/_/565855/_/961593371/
>------------------------------------------------------------------------






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Tom Igoe - Jun 21 11:17:00 2000

Wow, so it becomes a complicated thing, especially if I'M introducing
this to first-time students. So far this is the only thing I've
found that the basic stamp can do that the BX24 can't. Probably the
switch option is simplest. If anyone comes up with a simpler option
that doesn't involve changing hardware in the PC, please share it... >COM3 is bit banged using an interrupt at 4 times the baud rate. So for the
>31250 this would be 125,000 interrupts per second. This is much higher than
>we would like on COM3 and would reduce the processor to little to no
>foreground processing.
>
>As for COM1, it will change the 115,200 for downloading up to 125,000 I
>dont think that the PC can handle this much change. I think it might be
>better to use 2 crystals and a tiny switch while you are developing and then
>when your project is done, then you can change it back.
>
>The other option is to buy a cheap serial card, and change ITS xtal or
>oscillator. Many of these us a 7.3728Mhz crystal or a 1.8432 crystal. You
>can change this to a 8mhz or 2mhz crystal and you would be running at
>125,000 baud too! This would allow you to download and debug at the same
>speed.

--
--
Tom Igoe





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Michael Fellinger - Jun 21 16:01:00 2000

Look at Maxim's MAX3100 family. www.maxim-ic.com This would require
using the SPI interface, which is easy, but can cause strange behavior
unless done correctly. A 2MHz crystal would give you MIDI. Any baud rate
is possible with the right crystal. Normally you use a 1.8432MHz crystal.
Anything up to 4MHz will work, with scaled baud rates.

Michael Fellinger

-----Original Message-----
From: Tom Igoe <>
To: <>
Date: Wednesday, June 21, 2000 10:18 AM
Subject: Re: [BasicX] BX-24 and MIDI >Wow, so it becomes a complicated thing, especially if I'M introducing
>this to first-time students. So far this is the only thing I've
>found that the basic stamp can do that the BX24 can't. Probably the
>switch option is simplest. If anyone comes up with a simpler option
>that doesn't involve changing hardware in the PC, please share it... >>COM3 is bit banged using an interrupt at 4 times the baud rate. So for
the
>>31250 this would be 125,000 interrupts per second. This is much higher
than
>>we would like on COM3 and would reduce the processor to little to no
>>foreground processing.
>>
>>As for COM1, it will change the 115,200 for downloading up to 125,000 I
>>dont think that the PC can handle this much change. I think it might be
>>better to use 2 crystals and a tiny switch while you are developing and
then
>>when your project is done, then you can change it back.
>>
>>The other option is to buy a cheap serial card, and change ITS xtal or
>>oscillator. Many of these us a 7.3728Mhz crystal or a 1.8432 crystal.
You
>>can change this to a 8mhz or 2mhz crystal and you would be running at
>>125,000 baud too! This would allow you to download and debug at the same
>>speed.
>
>--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>SALESFORCE.COM MAKES SOFTWARE OBSOLETE
>Secure, online sales force automation with 5 users FREE for 1 year!
>http://click.egroups.com/1/2658/8/_/565855/_/961604286/
>------------------------------------------------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Jack Schoof - Jun 22 0:12:00 2000

I guarantee you that the Stamp cannot receive MIDI commands while processing
anything else. Since MIDI is a asyncronous event you dont know when the
midi will come at you.

Try using COM1 with the standard 7.3728Mhz crystal. Do the OpenCOM(1..) to
whatever baud rate you want and then perform the statement:

register.ubrr = 14

This should set the baud rate to 7372800/16/(14+1) = 30,720 baud.

This is 1.7% off of the "correct" midi baud rate of 31250, but the UART in
the MIDI device should be able to deal with this percentage error. Most
UARTS work up to 5% error.

Jack

-----Original Message-----
From: Tom Igoe <>
To: <>
Date: Wednesday, June 21, 2000 9:18 AM
Subject: Re: [BasicX] BX-24 and MIDI >Wow, so it becomes a complicated thing, especially if I'M introducing
>this to first-time students. So far this is the only thing I've
>found that the basic stamp can do that the BX24 can't. Probably the
>switch option is simplest. If anyone comes up with a simpler option
>that doesn't involve changing hardware in the PC, please share it... >>COM3 is bit banged using an interrupt at 4 times the baud rate. So for
the
>>31250 this would be 125,000 interrupts per second. This is much higher
than
>>we would like on COM3 and would reduce the processor to little to no
>>foreground processing.
>>
>>As for COM1, it will change the 115,200 for downloading up to 125,000 I
>>dont think that the PC can handle this much change. I think it might be
>>better to use 2 crystals and a tiny switch while you are developing and
then
>>when your project is done, then you can change it back.
>>
>>The other option is to buy a cheap serial card, and change ITS xtal or
>>oscillator. Many of these us a 7.3728Mhz crystal or a 1.8432 crystal.
You
>>can change this to a 8mhz or 2mhz crystal and you would be running at
>>125,000 baud too! This would allow you to download and debug at the same
>>speed.
>
>--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>SALESFORCE.COM MAKES SOFTWARE OBSOLETE
>Secure, online sales force automation with 5 users FREE for 1 year!
>http://click.egroups.com/1/2658/8/_/565855/_/961604286/
>------------------------------------------------------------------------






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Electronic Potentiometer - Jean-Michel Howland - Jun 22 3:48:00 2000

Hi,

I need to control a few pots on a piece of gear remotely and rather than
using motor driven pots I would prefer to use some sort of IC.

Does anyone have any ideas of pointers?

Regards,
Jean-Michel.





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Electronic Potentiometer - Jon Hylands - Jun 22 8:17:00 2000

On Thu, 22 Jun 2000 16:48:16 +0800, Jean-Michel Howland <>
wrote:

> Does anyone have any ideas of pointers?

Dallas makes an IC pot in their 1-wire family.

www.dalsemi.com

Later,
Jon

--------------------------------------------------------------
Jon Hylands http://www.huv.com/jon

Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
http://www.huv.com






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Electronic Potentiometer - Jean-Michel Howland - Jun 22 8:55:00 2000

>> Does anyone have any ideas of pointers?
>
>Dallas makes an IC pot in their 1-wire family.
>
>www.dalsemi.com

Thanks Jon, delsemi has the perfect solution!

Regards,
Jean-Michel.





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Serial port(s) problem - Jean-Michel Howland - Jun 22 9:10:00 2000

Hi all,

It's me again with yet another problem.

I'm trying to read data in from a tiny trackball
(http://www.vmapa.com/tb-top.jpg) and write out the data to my
LCD. Problem is I can only open Com3 once by the looks of it. I thought
you could define Com3 with different queues to many different pins as I
have done in the following code but with no luck.

Ideas?

Regards,
Jean-Michel. Option Explicit

Private Const LCD_Queue_Length As Integer = 30
Private Const TB_Queue_Length As Integer = 30

Private LCD_Serial_Output_Buffer(1 to LCD_Queue_Length) As Byte
Private TB_Serial_Input_Buffer(1 to TB_Queue_Length) As Byte

Sub Main()
Dim MouseData(1 To 6) As byte
Dim MouseDataStr As String

Call LCD_Open_Serial_Port
Call TB_Open_Serial_Port

Call LCD_Cursor_Off
LCD_Clear_Screen

Do
If StatusQueue(TB_Serial_Input_Buffer) Then
Call GetQueue(TB_Serial_Input_Buffer, MouseData, 6)
MouseDataStr = CStr(MouseData(1)) & ":" & _
CStr(MouseData(2)) & ":" & _
CStr(MouseData(3)) & ":" & _
CStr(MouseData(4)) & ":" & _
CStr(MouseData(5)) & ":" & _
CStr(MouseData(6))
Call LCD_Send_String(MouseDataStr)
End If
Loop
End Sub

Private Sub LCD_Open_Serial_Port()
Call OpenQueue(LCD_Serial_Output_Buffer, LCD_Queue_Length)
Call DefineCom3(0,5,&H88)
Call OpenCom(3, 9600, LCD_Serial_Output_Buffer,
LCD_Serial_Output_Buffer)
End Sub

Private Sub TB_Open_Serial_Port()
Call OpenQueue(TB_Serial_Input_Buffer, TB_Queue_Length)
Call DefineCom3(6,0,&H07)
Call OpenCom(3, 1200, TB_Serial_Input_Buffer, TB_Serial_Input_Buffer)
End Sub

Private Sub LCD_Clear_Screen()
Call LCD_Send_Byte(12)
End Sub

Private Sub LCD_Cursor_Off()
Call LCD_Send_Byte(25)
Call LCD_Send_Byte(0)
End Sub

Private Sub LCD_Send_String(ByVal Value As String)
Call PutQueueStr(LCD_Serial_Output_Buffer, Value)
End Sub

Private Sub LCD_Send_Byte(ByVal Value As Byte)
Call PutQueue(LCD_Serial_Output_Buffer, Value, 1)
End Sub





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Tom Igoe - Jun 22 9:30:00 2000

Will try that too.

Most of the time, with the stamp, we don't make projects to receive
midi. We use it only as a midi controller, outputting messages in
response to sensors. Works very well for that. I think the basicx
will too, if I can get one of these solutions to work. Will post
here if I get good results, in grateful appreciation. >I guarantee you that the Stamp cannot receive MIDI commands while processing
>anything else. Since MIDI is a asyncronous event you dont know when the
>midi will come at you.
>
>Try using COM1 with the standard 7.3728Mhz crystal. Do the OpenCOM(1..) to
>whatever baud rate you want and then perform the statement:
>
>register.ubrr = 14
>
>This should set the baud rate to 7372800/16/(14+1) = 30,720 baud.
>
>This is 1.7% off of the "correct" midi baud rate of 31250, but the UART in
>the MIDI device should be able to deal with this percentage error. Most
>UARTS work up to 5% error.
--
--
Tom Igoe





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Electronic Potentiometer - Jon Hylands - Jun 22 13:01:00 2000

On Thu, 22 Jun 2000 21:55:46 +0800, Jean-Michel Howland
<> wrote:

> >Dallas makes an IC pot in their 1-wire family.
> >
> >www.dalsemi.com
>
> Thanks Jon, delsemi has the perfect solution!

I don't know if you saw it, but I have posted a pretty complete Dallas
1-wire interface for the BX-24 to the files area... It should work
pretty well with multiple pots, and you can even throw in an 1820 or
two to measure temperature :-)

Later,
Jon

--------------------------------------------------------------
Jon Hylands http://www.huv.com/jon

Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
http://www.huv.com





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: Serial port(s) problem - Author Unknown - Jun 22 15:31:00 2000

At 10:10 PM 6/22/00 +0800, you wrote:

>Hi all,
>
>It's me again with yet another problem.
>
>I'm trying to read data in from a tiny trackball
>(http://www.vmapa.com/tb-top.jpg) and write out the data to my
>LCD. Problem is I can only open Com3 once by the looks of it.

Can you use com1 and com3 instead of opening two com3's? Just a thought...

Duncan





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Tom Igoe - Jun 26 15:49:00 2000

Tried Jack's solution below to do MIDI out on a BX-24 today, and got
mighty close. On a synth I've got, and a separate MIDI interface
box, both would flash their "MIDI received" LED's at me when I sent
in bytes, but received bad data. Not sure why, all I can figure is
that 1.5% made a difference. Here's the code:

Sub Main()
dim note as byte
debug.print "starting"

call DefineCom3 (11, 12, bx1000_1000)
call OpenSerialPort(3, 19200)

register.ubrr = 14
call putPin(25, 1)
do
for note = 36 to 96
call putByte(144)
call putByte(note)
call putByte(64)
call putPin(25, 0)
call delay(1.0)
call putByte(144)
call putByte(note)
call putByte(0)
call putPin(25, 1)
call delay(1.0)
next

loop

End Sub

(note: serialport.bas was used as well...)

Instead of 144,36,64, 144 36, 0, etc. I got things like 128, 44, 0,
164, 0, 30 etc. No rhyme or reason.

Any thoughts, anyone?

Meanwhile I'm going to look into Michael Fellinger's MAX3100 solution...
>Try using COM1 with the standard 7.3728Mhz crystal. Do the OpenCOM(1..) to
>whatever baud rate you want and then perform the statement:
>
>register.ubrr = 14
>
>This should set the baud rate to 7372800/16/(14+1) = 30,720 baud.
>
>This is 1.7% off of the "correct" midi baud rate of 31250, but the UART in
>the MIDI device should be able to deal with this percentage error. Most
>UARTS work up to 5% error.
--
--
Tom Igoe





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Jack Schoof - Jun 26 17:16:00 2000

ONLY COM1 will work in this manner. The UBRR function is for setting the
COM1 port.

Jack -----Original Message-----
From: Tom Igoe <>
To: <>
Date: Monday, June 26, 2000 1:51 PM
Subject: Re: [BasicX] BX-24 and MIDI >Tried Jack's solution below to do MIDI out on a BX-24 today, and got
>mighty close. On a synth I've got, and a separate MIDI interface
>box, both would flash their "MIDI received" LED's at me when I sent
>in bytes, but received bad data. Not sure why, all I can figure is
>that 1.5% made a difference. Here's the code:
>
>Sub Main()
> dim note as byte
> debug.print "starting"
>
> call DefineCom3 (11, 12, bx1000_1000)
> call OpenSerialPort(3, 19200)
>
> register.ubrr = 14
>call putPin(25, 1)
> do
> for note = 36 to 96
> call putByte(144)
> call putByte(note)
> call putByte(64)
> call putPin(25, 0)
> call delay(1.0)
> call putByte(144)
> call putByte(note)
> call putByte(0)
> call putPin(25, 1)
> call delay(1.0)
> next
>
> loop
>
>End Sub
>
>(note: serialport.bas was used as well...)
>
>Instead of 144,36,64, 144 36, 0, etc. I got things like 128, 44, 0,
>164, 0, 30 etc. No rhyme or reason.
>
>Any thoughts, anyone?
>
>Meanwhile I'm going to look into Michael Fellinger's MAX3100 solution... >
>>Try using COM1 with the standard 7.3728Mhz crystal. Do the OpenCOM(1..)
to
>>whatever baud rate you want and then perform the statement:
>>
>>register.ubrr = 14
>>
>>This should set the baud rate to 7372800/16/(14+1) = 30,720 baud.
>>
>>This is 1.7% off of the "correct" midi baud rate of 31250, but the UART in
>>the MIDI device should be able to deal with this percentage error. Most
>>UARTS work up to 5% error.
> >--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>IT Professionals: Match your unique skills with the best IT projects at
>http://click.egroups.com/1/3381/8/_/565855/_/962052601/
>------------------------------------------------------------------------






(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )

Re: BX-24 and MIDI - Jack Schoof - Jun 26 17:48:00 2000

COM1 is inverted remember so you would need to account for this in your
hardware for the MIDI port.

Jack

-----Original Message-----
From: Tom Igoe <>
To: <>
Date: Monday, June 26, 2000 3:33 PM
Subject: Re: [BasicX] BX-24 and MIDI >>ONLY COM1 will work in this manner. The UBRR function is for setting the
>>COM1 port.
>>
>>Jack >
>I thought that; got similar results off com1, that's when I switched
>to com3. Sorry, should have mentioned that.
>--
>--
>Tom Igoe
>
>------------------------------------------------------------------------
>IT Professionals: Match your unique skills with the best IT projects at
>http://click.egroups.com/1/3381/8/_/565855/_/962058760/
>------------------------------------------------------------------------





(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )