Jump to content

Midi-to-com specification needed and merging help


FJMSoft
 Share

Recommended Posts

Hello, I'm building a 8051 based midi controller, and want to make it compatible with serial port (to-com), I have searched a lot the web for some documentation and didnt found, somebody knows where can I find or can help me? Can I set even higher baudrates? (of course, on both computer and controller)

Another question is, I want to have a, midi-in port in my controller too, I'm trying to figure out how could I merge data sent by my controller and data received by port, I know you may dont know how to code 8051, but I need just an analogy, any help/idea will be very well welcome.

Thanks a lot.

Link to comment
Share on other sites

Theoretically any baud rate will do, but it's all about the driver on the COM port being able to make sense of it... They all seem to use 38400 (for obvious reasons) so that's the way.

As for the best way to do a merge... heck who am I to suggest anything but TK's way. Check the MIOS source, but check the license too ;)

Link to comment
Share on other sites

Hi Stryd, thanks for your answer. You mean midi-to-com is SAME normal midi but with a baud rate compatible to PC serial port?

About merging, will take some time so I can understand merger code, and I dont want to copy it, I want to code myself, can you try to explain for me an analogy of the process?

Thanks again

Link to comment
Share on other sites

Yes, MIDI-to-COM runs at 38200 baud, it's a baudrate which most PCs can handle.

Merging MIDI data: first the hint, that you won't be able to run the UART with different baudrates for Rx and Tx port. So, you either need a 8051 derivative with second UART, or an external UART like MBHP_IIC_MIDI (the most flexible solution, as it especially simplifies merging).

The approach behind merging MIDI streams: the receiver needs to block the main task (which generates MIDI data internally) whenever a MIDI event is received. An event consists of 2 or 3 bytes, for coding see the MIDI spec. Only exception is a SysEx stream, which starts with F0 and ends with F7...

The MIDI protocol allows to omit the first byte (status byte) if it is identical to the previous one. This is called "running status. Your handler needs to take care about this, otherwise it could hang up as less bytes are received than expected. A status byte is indicated by bit #7

Another exception are the realtime events 0xf8..0xff - they don't change the running status, and can even be received in between a MIDI event.

It makes sense to add a timeout handler, which breaks when a MIDI event hasn't been completely received within a certain time (200 mS is a good value)

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...