Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Keoni29 on November 12, 2011, 04:31:56 am

Title: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 04:31:56 am
Hey guys! I'm working on a midiadapter for the TI 83 series calculators. The hardware is neary done (need a midi socket) I found this code on the arduino website:
Code: [Select]
void setup() {
  //  Set MIDI baud rate:
  Serial.begin(31250);
}

void loop() {
  // play notes from F#-0 (0x1E) to F#-5 (0x5A):
  for (int note = 0x1E; note < 0x5A; note ++) {
    //Note on channel 1 (0x90), some note value (note), middle velocity (0x45):
    noteOn(0x90, note, 0x45);
    delay(100);
    //Note on channel 1 (0x90), some note value (note), silent velocity (0x00):
    noteOn(0x90, note, 0x00); 
    delay(100);
  }
}

//  plays a MIDI note.  Doesn't check to see that
//  cmd is greater than 127, or that data values are  less than 127:
void noteOn(int cmd, int pitch, int velocity) {
  Serial.write(cmd);
  Serial.write(pitch);
  Serial.write(velocity);
}
I wonder what the output of this code is (in binairy) so that I can write a midi routine in axe.
Title: Re: AXE midi out adapter
Post by: Jim Bauwens on November 12, 2011, 04:38:23 am
Looks pretty easy, just a serial protocol :)
I don't know how easy it is to do with a TI-83, but its quite simple.
You should look first at making it output serial data, sending the bytes together with the stop bits at the right bitrate.
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 04:47:06 am
Looks pretty easy, just a serial protocol :)
I don't know how easy it is to do with a TI-83, but its quite simple.
You should look first at making it output serial data, sending the bytes together with the stop bits at the right bitrate.
Serial.begin(31250);
That is the bitrate in bits/second. 31kHz is very high. I might have to use a microcontroller to speed up the signal.
Where should I put the stop/start bits exactely?
Title: Re: AXE midi out adapter
Post by: Jim Bauwens on November 12, 2011, 04:55:48 am
Take a look at this: http://patents.ame.nd.edu/microcontroller/main/node24.html
and this
http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

UART and RS-232 are your keywords :)
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 05:03:47 am
Take a look at this: http://patents.ame.nd.edu/microcontroller/main/node24.html
and this
http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter

UART and RS-232 are your keywords :)
So a start bit is logic 1 and a stop bit is slightly longer than a normal bit and logic 0. What does logic 1 mean? No current flow? (I'm confuses about inverted signals :P)
Title: Re: AXE midi out adapter
Post by: Jim Bauwens on November 12, 2011, 05:08:14 am
I'm not sure, but I think high is one.
Also 31250 is not really the bit rate, but changes/sec (unit is baud) ^^
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 05:10:50 am
I'm not sure, but I think high is one.
Also 31250 is not really the bit rate, but changes/sec (unit is baud) ^^
So is it doable using axe?
Title: Re: AXE midi out adapter
Post by: Jim Bauwens on November 12, 2011, 06:10:33 am
I don't know, since I don't know how good you can control the port from axe.
I'm not a z80 guy ^^

Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 09:51:31 am
I should get an arduino :p Solves every problem.
Title: Re: AXE midi out adapter
Post by: DJ Omnimaga on November 12, 2011, 02:04:03 pm
Interesting. Would it let you use for example a calc as a midi keyboard or just an actual midi keyboard to play music on your calc?
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 02:05:57 pm
Interesting. Would it let you use for example a calc as a midi keyboard or just an actual midi keyboard to play music on your calc?
It sends midi notes to an external midi device.
Title: Re: AXE midi out adapter
Post by: DJ Omnimaga on November 12, 2011, 02:12:41 pm
Ah ok cool :)
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 02:16:45 pm
It will support all midi features I hope so it's gonna be awesomesauce if it works. Shootout to thepenguin77 for his UART axiom.
Title: Re: AXE midi out adapter
Post by: epic7 on November 12, 2011, 04:34:32 pm
Does it need a special midi cord or something?
Title: Re: AXE midi out adapter
Post by: Juju on November 12, 2011, 04:47:45 pm
Sounds awesome. I have an Arduino, I might try it. Or even help.
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 12, 2011, 04:55:11 pm
Does it need a special midi cord or something?
No, but you gotta build a small piece of hardware. You need a 1k, 220 and 800 ohm resistor, a 9v battery, a midi socket,a 2.5mm plug socket and a pnp transistor
Sounds awesome. I have an Arduino, I might try it. Or even help.
No arduinos involved, but thank you for the offer.
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 13, 2011, 07:48:04 am
It doesn't work. I will check the signal with a digital osciloscope.

Edit: I think it's the hardware. I don't have a clue :( Every site tells me to do it differently :(
Title: Re: AXE midi out adapter
Post by: Jim Bauwens on November 13, 2011, 09:39:40 am
Maybe the signal polarity is wrong (reversed), you could check that again.
Title: Re: AXE midi out adapter
Post by: Keoni29 on November 13, 2011, 10:16:03 am
Nope I know what's wrong! Midi parameters are 7 bits instead of 8 bits!
The first parameter (command and channel) is 8-bits, but the following two are supposed to be 7 bits long!