MIDI out can''t coexist with other form of outputs
At 15:55 04/06/02, payamrice wrote:
>Ok I have a school project which is using 8 pins to trigger 8 24 volt
>relays (with the use of transistors) and it also sends out 10
>different midi velocities formsomething else. The problem that I'm
>having is that neither of these can coexist for some reason. When
>only the midi is running everything works fine and when only the 8
>outputs are running every relay switches fine. As soon as everything
>is plugged in, the midi stops working after 5-10 seconds. I just
>wanted to know f someone can look at the code and tell me if there's
>anything wrong or not. Thanks!
I'm not too familiar with the serout command, but you seem to have it
correct given the following things I know about MIDI data.
1. The baud rate for MIDI is 31,250 baud.
2. Data is 1 start bit, 8 data bits, 1 stop bit, no parity.
Are you generating a MIDI signal that consists of varying voltage, or a
varying current? MIDI is a current loop mode where a MIDI logic one is
zero MA current and a MIDI logic zero is a 5 MA current.
The following page gives about all the physical details you'll ever need,
including spec compliant interface circuitry. Maybe that will help.
http://crystal.apana.org.au/ghansper/midi_introduction/physical_layer.html
If the program works fine for long periods of time if you bypass the relay
portion of the program, then I'd suspect some unwanted hardware interaction
between the interface to the relays and the interface to the MIDI
device. I don't know what your hardware looks like, but you might want to
put a short delay at the end of the loop that switches the relays before
going to the MIDI portion of the program and vice versa to let things
settle down a bit more - but that's just a wild stab in the dark guess.
Good luck.
Jim Higgins
>Here's the sample:
>
>note: I'm simply reading to values that are coming in on pins 1 and 2
>and based on the values toggling certain pins and sending certain
>midi velocities.
>
>MAINLOOP:
>..
>...
>....
>
>control = sensorX - sensor Y (the sensors work fine)
>
>IF control < 2000 THEN goto setup1
>IF control.....
>
>setup1:
>
>HIGH 1
>HIGH 2
>HIGH 3
>HIGH 4
>LOW 5
>LOW 6
>LOW 7
>LOW 8
>serout 15,$8000+12,0,[noparse][[/noparse]144,0,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,1,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,2,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,3,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,4,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,5,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,6,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,7,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,8,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,9,0]
>
>Goto MAINLOOP
>
>setup2:
>
>..
>...
>....
>Ok I have a school project which is using 8 pins to trigger 8 24 volt
>relays (with the use of transistors) and it also sends out 10
>different midi velocities formsomething else. The problem that I'm
>having is that neither of these can coexist for some reason. When
>only the midi is running everything works fine and when only the 8
>outputs are running every relay switches fine. As soon as everything
>is plugged in, the midi stops working after 5-10 seconds. I just
>wanted to know f someone can look at the code and tell me if there's
>anything wrong or not. Thanks!
I'm not too familiar with the serout command, but you seem to have it
correct given the following things I know about MIDI data.
1. The baud rate for MIDI is 31,250 baud.
2. Data is 1 start bit, 8 data bits, 1 stop bit, no parity.
Are you generating a MIDI signal that consists of varying voltage, or a
varying current? MIDI is a current loop mode where a MIDI logic one is
zero MA current and a MIDI logic zero is a 5 MA current.
The following page gives about all the physical details you'll ever need,
including spec compliant interface circuitry. Maybe that will help.
http://crystal.apana.org.au/ghansper/midi_introduction/physical_layer.html
If the program works fine for long periods of time if you bypass the relay
portion of the program, then I'd suspect some unwanted hardware interaction
between the interface to the relays and the interface to the MIDI
device. I don't know what your hardware looks like, but you might want to
put a short delay at the end of the loop that switches the relays before
going to the MIDI portion of the program and vice versa to let things
settle down a bit more - but that's just a wild stab in the dark guess.
Good luck.
Jim Higgins
>Here's the sample:
>
>note: I'm simply reading to values that are coming in on pins 1 and 2
>and based on the values toggling certain pins and sending certain
>midi velocities.
>
>MAINLOOP:
>..
>...
>....
>
>control = sensorX - sensor Y (the sensors work fine)
>
>IF control < 2000 THEN goto setup1
>IF control.....
>
>setup1:
>
>HIGH 1
>HIGH 2
>HIGH 3
>HIGH 4
>LOW 5
>LOW 6
>LOW 7
>LOW 8
>serout 15,$8000+12,0,[noparse][[/noparse]144,0,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,1,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,2,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,3,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,4,127]
>serout 15,$8000+12,0,[noparse][[/noparse]144,5,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,6,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,7,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,8,0]
>serout 15,$8000+12,0,[noparse][[/noparse]144,9,0]
>
>Goto MAINLOOP
>
>setup2:
>
>..
>...
>....