PICAXE 14M2 Midi Decoder or other PICAXE

hello,

i am looking to build a midi controlled xylophone. rather then using 32 solenoids i want to use 4 servos with strikers connected. each servo will position over the correct note and a second mechanism will strike the play surface. each servo will have a certain range of notes it can physically reach. all i need help is with regards to decoding midi. the main loop will listen to midi and when it rx’s a note it will exit the loop and perform the servo task then return to the main loop. is a PICAXE fast enough where it could buffer and play 4 notes at once? there will be 32 conditions/notes (F2 to C5) which will output servo positions (once built then i can document each servo position so I can create a truth table). I can program those conditions but have no idea how to read the midi and extract the information such as note on and the note value.

hopefully i didn’t sound like an idiot and thank you for your time
james

fcd72 had a MIDI unit in the works and is a picaxe guy. Wait for him :slight_smile:

Moin!

To Process MIDI Succesfully you won’t go with the 14M2 as it doesn’t support Background Hardware Serial Receive into the Scratchpad RAM - you’ll only have 2 Bytes Buffer that will overrun instantly. Better get a 20x2 or even better a 28x2 Chip (the later with 1024 Bytes Scratchpad RAM).

Here are some Code Snippets:

'First you’ll have to speed up things a bit:

init:
'CLOCK AUF 64MHZ SETZEN - 20X2
setfreq m64

'and then you’ll have to configure the Serial Port for MIDI:

'SERIELLE SCHNITSTELLE EINSTELLLEN 31500baud, background receive, 64MHz
hsersetup B31250_64, %001

'INTERRUPT SETZEN BIT 5 HIGH FÜR INTERRUPT BEI RECEIVE
hserptr = 0
setintflags %00100000, %00100000

'Thats pretty much all you need to receive MIDI automatically and have it written into your Scratchpad RAM used as circular Buffer. The Intterupt then will be called whenever a Byte is received. You may use the Mutable Instruments Reference MIDI In Optocoupler Circuit for Hardware.

Insider your INTERRUPT: Routine you’ll then need a Counter (INTEGER for 20X2, WORD for 28,40x2) that points to the last position you read, hserptr will always point to the last received Byte.

Simply parse everything between this :), just search for a MIDI Specification you can understand i use this one

Thinking about the Servos: id highly recommend using solenoids as the HSER part may collide internally with the timers for the Servos (a Pic does not have as much timers as an AVR) so your Servos might act strange or not at all. Simply use 4 4051s (3 DATA Pins for all 4051 and 4 Select Pins to select the appropriate 4051) to trigger your Solenoid Drivers, make sure these Pins are all at the same Port, so you can set them all at once with the “PinsX” command like this: PinsA=lcd_value

thank you very much. i will order the 28x2 and research the MIDI specs. please note i am usually slow to respond due to my job :frowning: however I look forward to updating this discussion.

Get a 40x2, too, its not much more expensive but has 12 additional pins….