Jidis Posted May 8, 2005 Report Share Posted May 8, 2005 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) Quote Link to comment Share on other sites More sharing options...
TK. Posted May 8, 2005 Report Share Posted May 8, 2005 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 => F0Counter == 1 => 15Counter == 2 => 15Counter == 3 => 00etc.once a byte doesn't match, reset the counter to 0once the counter is 5, you can switch on/off the LED depending on the received byteThe 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 byteSysEx parsing: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.