Jump to content

Another newbie PIC-MIDI question


Jidis
 Share

Recommended Posts

I'm trying to learn my way around some PIC assembler and figured I'd try to make something I want. It's about as simple as it gets.

I just want to switch a single output line on and off with two specific SysEx messages. I want it to ignore all else and start with it off (low).

The messages are two JL Cooper CS-10 commands (7 bytes each)-

F0 15 15 00 12 7F F7      is "on"

F0 15 15 00 12 00 F7      is "off"

I found an ASM file for a 7 output MIDI to solenoid circuit using a 16f84 and it has helped me get a grasp on the "byte read" part of the interrupt routine. The timing and the frame check stuff has also already been worked out there. From that point, the writer goes on to number the 3 incoming note bytes and store their contents for later use. I don't guess I need any of that.

What is the obvious way of checking for this string of hex? Do I check a byte at a time as they come in and drop out if I get a wrong byte, or do I get all seven and check afterward?

                                        -Thanks!   

PS- Two other stupid questions- Does a message like this always appear in one long uninterrupted string, even if the line were active with other MIDI messages? And, is there no reliable byte to byte MIDI timing? (can you count bits through one byte into the next or do you always clock from the start bit)

Link to comment
Share on other sites

Do I check a byte at a time as they come in and drop out if I get a wrong byte, or do I get all seven and check afterward?

the first idea is the better one. You could use a counter which selects the byte for which you are waiting for.

Counter == 0 => F0

Counter == 1 => 15

Counter == 2 => 15

Counter == 3 => 00

etc.

once a byte doesn't match, reset the counter to 0

once the counter is 5, you can switch on/off the LED depending on the received byte

The F7 can be ignored (if you don't want to implement an error handler)

PS- Two other stupid questions- Does a message like this always appear in one long uninterrupted string, even if the line were active with other MIDI messages?

the MIDI protocol allows to interrupt SysEx strings with realtime messages like MIDI clock, but such messages can be easily filtered out, just ignore all bytes which are >= 0xf8

And, is there no reliable byte to byte MIDI timing? (can you count bits through one byte into the next or do you always clock from the start bit)

There is always a start and stop bit at the begin/end of a byte

SysEx parsing:

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...