MIDI Control from PICAXE-18X

hippy

Ex-Staff (retired)
It seems the PICAXE-18X can control the on-chip AUSART and Output Pin 5 can be used for high-speed serial output ( see other posts ) and also for MIDI Out ...

http://homepage.ntlworld.com/the.happy.hippy/picaxe/midiuart.txt

Two resistors and a DIN socket and you have a MIDI controller. The 220R are as defined in the official MIDI 1.0 Specification. Requires about 3mA in total with no other circuitry.

Also appears to work at 4MHz with 'SPBRG_INIT = 1'. Plenty of scope for the code to be optimised; I don't think the check for buffer empty in UartTx needs to be there as the byte transmission time is less than the PICAXE instruction execution time.

Note that CHANNEL is 1 to 16 ( not 0 to 15 ) to match real world conventions.

Also note that one 220R goes to +5V, and if you put it to 0V ( D'Oh ! ) or swap the wires over, you'll either get nothing or a lot of 'MIDI Buffer Full" and other error messages.

Apart from Output 5 being used for MIDI Out ( and Output 2 appears to get forced low ), the PICAXE can be used as normally, so plenty of scope for <i>something </i> to MIDI devices.

Doesn't seem to work with an 18, the 08, 08M and 18A don't have AUSART's, but should also work on 28's and 40X. No guarantees it will work with all 18X's, but I suspect it will.
 

forn

New Member
I tried the midi Out whit a 28A System and I had no succes. Some questions:
- The 28A has a 16F872 with I2C/SPI but without AUSART interface. Is there any way of using this interface for midi porpuses.
- Can I program and test a Picaxe 28X microchip (with AUSART) in a 28A?
- When you say pin5 as an output, do you refers to the board ouput or a direct output from the microchip?
 

hippy

Ex-Staff (retired)
<i>The 28A has a 16F872 with I2C/SPI but without AUSART interface. Is there any way of using this interface for midi porpuses. </i>

I thought the 16F872 had an AUSART but was wrong; the 28 and 28A cannot be used for MIDI or any other high-speed serial.

<i>Can I program and test a Picaxe 28X microchip (with AUSART) in a 28A? </i>

You can develop the program and run it on a 28A but as the 28A doesn't have a AUSART it won't work as expected and could quite likely seize up unless the code which interfaces with the expected AUSART is commented out. This could limit the amount of testing which can be done, but it is a sensible way to develop preliminary code if you don't have the right chip to hand.

<i>When you say pin5 as an output, do you refers to the board ouput or a direct output from the microchip? </i>

That was Digital Output 5 on the 18X chip, Leg 11. On the 28X, the MIDI Output would come from Leg 17.
 

hippy

Ex-Staff (retired)
Just spotted a bug in te posted code linked above ...<code><pre><font size=2 face='Courier'> char = PROG_CHANGE | CHANNEL-1
char = NOTE_ON | CHANNEL-1 </font></pre></code> This will not work with SYMBOL CHANNEL=16, and should be changed to ...<code><pre><font size=2 face='Courier'> char = PROG_CHANGE + CHANNEL-1
char = NOTE_ON + CHANNEL-1 </font></pre></code>
 
Top