anakin Posted November 5, 2007 Report Posted November 5, 2007 HiI need just a little help for changing the ain64_din128_dout128_v2_0 apps handling of dout.I really want to know the right way for changing the din-dout relationship because I have 64 dins but only 4 led because I need to read the state only for 4 dins: But these dins are 20,21,22,23 and I don't want to plug 3 74hc595 for doin'g this because 1 74hc595 can do this...but I have to assign din 20 to led 1, din 21 to led 2, din 22 to led 3, din 23 to led 4.How and where can I do this mod?Thank you very much!Anakin Quote
audiocommander Posted November 5, 2007 Report Posted November 5, 2007 Hi Anakin,the relevant section is in main.c[tt]/////////////////////////////////////////////////////////////////////////////// This function is called by MIOS when a complete MIDI event has been received/////////////////////////////////////////////////////////////////////////////void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam{ // check if note on or off event at channel 1 has been received if( evnt0 == 0x80 || evnt0 == 0x90 ) { // if note off event: force evnt2 to 0 for easier handling of 'LED off' if( evnt0 == 0x80 ) evnt2 = 0; // number of DOUT pin in evnt1, value in evnt2 MIOS_DOUT_PinSet(evnt1, evnt2 ? 0x01 : 0x00); // notify display handler in DISPLAY_Tick() that DOUT value has changed last_dout_pin = evnt1; app_flags.DISPLAY_UPDATE_REQ = 1; }}[/tt]So, at the moment, the DOUTs are controlled by sending MIDI-Messages.You have to move the [tt]MIOS_DOUT_PinSet()[/tt] to the DIN-Section and adapt the numbers, e.g. by using a switch case.[tt]/////////////////////////////////////////////////////////////////////////////// This function is called by MIOS when an button has been toggled// pin_value is 1 when button released, and 0 when button pressed/////////////////////////////////////////////////////////////////////////////void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam{ // a button has been pressed, send Note at channel 1 MIOS_MIDI_BeginStream(); MIOS_MIDI_TxBufferPut(0x90); // Note at channel 1 MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to note number MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // buttons are high-active MIOS_MIDI_EndStream(); // your switch case here // notify display handler in DISPLAY_Tick() that DIN value has changed last_din_pin = pin; app_flags.DISPLAY_UPDATE_REQ = 1;}[/tt]Regards,Michael Quote
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.