ranger930 Posted November 20, 2023 Report Posted November 20, 2023 (edited) Hello mios friends, I have a midi controller based on a PIC18F452 and have programmed it in C. Is there a routine after starting the operating system that can read all inputs once and send the determined values as midi out (without turning a potentiometer or pressing a button)? br ranger930 Edited November 20, 2023 by ranger930 Quote
TK. Posted November 26, 2023 Report Posted November 26, 2023 Hi, you could send values from the Tick() hook - by using a static variable you can ensure that the values will only be sent once after startup. Something like this (untested code) ///////////////////////////////////////////////////////////////////////////// // This function is called by MIOS in the mainloop when nothing else is to do ///////////////////////////////////////////////////////////////////////////// void Tick(void) __wparam { static unsigned char ain_sent = 0; if( ain_sent == 0 ) { unsigned char pin; unsigned char num_ain = MIOS_AIN_NumberGet(); ain_sent = 1; // only sent once after startup for(pin=0; pin < num_ain; ++pin) { MIOS_MIDI_TxBufferPut(0xb0); // CC at channel 1 MIOS_MIDI_TxBufferPut(pin); // pin number corresponds to CC number MIOS_MIDI_TxBufferPut(MIOS_AIN_Pin7bitGet(pin)); } } } Best Regards, Thorsten. 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.