PDA

View Full Version : A little C# + Olsen 595 help



pifantastic
09-09-2008, 12:09 AM
So I was bored the other day and decided it would be cool if I could control my 32 channel Olsen 595 with my MIDI keyboard.

I've gotten pretty far, in fact, I have the lights lighting up when I hit keys, but I'm getting really weird behavior. I was hoping that someone out there with some C# knowledge could help me debug this piece of code.

This function should take an integer array and output it to the parallel port. Each slot in the keys array represents a channel on the board, and the value represents the velocity of the key.



int clockhi = 1; // bin 00000001
int clocklo = 3; // bin 00000011
int latchhi = 2; // bin 00000010
int latchlo = 3; // bin 00000011

try
{
for (int x = 0; x < 32; x++)
{
Output(888, (keys[x] > 0) ? 1 : 0);
Output(890, clockhi);
Output(890, clocklo);
}
Output(890, latchhi);
Output(890, latchlo);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}


Whenever I tickle the ivories, I get random keys lighting up and eventually no channels will work. Any ideas?

Let me know if I need to give more information.

pifantastic
09-09-2008, 03:37 AM
So apparently I had the latching and clocking actions switched :(

I guess the algorithm here (http://computerchristmas.com/christmas/link-how_to/HowToId-25/Build_a_1024_Port_Controller_for_100) is wrong?

Oh wells, its working not and it pretty fun to play with. Now all I have to do is figure out how to route the MIDI signal to Reason!

P. Short
09-09-2008, 02:43 PM
I would say that other page is wrong...