macsurfer4 Posted October 5, 2006 Report Posted October 5, 2006 Hi, all of you.I´m building a small Midibox 64. It has only 8 Buttons with Prg-Change Commands from 1 to 8. It works fine but there´s a additional wish i have.May it be possible to display the last pushed button (e.g. Prg-Change 5) on a 8 digit display?Or the other way, can i have the led lighting up and hold when i press another button?(e.g Prg-Change 4, LED 5 off and LED 4 on)I have no idea of programming assembler or C but i will learn if you want me to- ;)See you later.Macsurfer4 Quote
audiocommander Posted October 6, 2006 Report Posted October 6, 2006 Hi Macsurfer4,I don't know if there's a "hack" to enable an 8 digit display for MB64 (can be...),but your demands are a quite simple task for programming your own application in C.Sending a PRG-CH from the DIN_Notify-Function needs two lines of code (MIOS_MIDI_TxBufferPut: MIDI-PRG-CH + Value), switchin an LED takes also just two lines (MIOS_DOUT_PinSet...: all off, last one on);Implementing an 8 digit display would require to switch multiple DOUTs to build the relevant numbers, not really a lot more complicated ;)So, if you're not using any other functions from the MB64 app (like banksticks, LCD-menus or sth like that), this seems like a doable task for programming beginners!You could also do a seach in the forum for segmented LED displays, I think there are some threads around...Cheers,Michael Quote
macsurfer4 Posted October 9, 2006 Author Report Posted October 9, 2006 :) :D ;D 8)Hi there,what fun is programming, yeeh ha!!OK, i´m normal now. I did get help from a friend who is a good programmer.He showed me some functions:I can MIOS_MIDI_TxBufferPut(0xC1), I mean send Prg-Change, I can light up the right led, in connection with a pushed button,I can display "Programm 1-8" on the LCD,I can merge midi in to out with MIOS_MIDI_MergerSet(0x01)I´m really happy right now, this little box is working fine and it was quite easy.So i am waiting for the parts now but the programming part is done!The Box will have 8 Prg Change Buttons with Status LEDs, 2 Buttons for future functions, 1 Panic Button (Controller 123), and maybe a lcd display.But i have one more question, is it possible to display e.g. Programm 1,2,... a bigger type, i mean over 2 lines of the 2x20 display instead of a 8 digit display?Greetings macsurfer4 (micha)So here is some code, if you want please do some advices://///////////////////////////////////////////////////////////////////////////// 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{ if(pin_value == 0 && pin <= 8) { // send program change status byte MIOS_MIDI_TxBufferPut(0xC1); // send program number MIOS_MIDI_TxBufferPut(pin); // switch all leds off MIOS_DOUT_PinSet0(0); MIOS_DOUT_PinSet0(1); MIOS_DOUT_PinSet0(2); MIOS_DOUT_PinSet0(3); MIOS_DOUT_PinSet0(4); MIOS_DOUT_PinSet0(5); MIOS_DOUT_PinSet0(6); MIOS_DOUT_PinSet0(7); // switch pressed led on MIOS_DOUT_PinSet1(pin); //diplay Program number MIOS_LCD_Clear(); MIOS_LCD_CursorSet(0x00); MIOS_LCD_PrintCString("Program"); MIOS_LCD_PrintBCD3(pin+1); } else if(pin_value == 0 && pin == 11) { // send controller status byte MIOS_MIDI_TxBufferPut(0xB1); // send controller number MIOS_MIDI_TxBufferPut(0x7B); MIOS_MIDI_TxBufferPut(0x00); }}and one more for the merger/////////////////////////////////////////////////////////////////////////////// This function is called by MIOS after startup to initialize the // application/////////////////////////////////////////////////////////////////////////////void Init(void) __wparam{ // set shift register update frequency MIOS_SRIO_UpdateFrqSet(1); // ms // we need to set at least one IO shift register pair MIOS_SRIO_NumberSet(16); // for 128 pins // debouncing value for DINs MIOS_SRIO_DebounceSet(10); //set midi merger on MIOS_MIDI_MergerSet(0x01);} Quote
audiocommander Posted October 9, 2006 Report Posted October 9, 2006 if(pin_value == 0 && pin <= 8) hehe ;D ...if the pin is uncooler than cool... I like that :)You could take a look in some examples to find out how to deal with the DISPLAY_Tick() function; clearing the screen takes some time, but in your case (not time critical) your solution to it is quite fine! ;)But i have one more question, is it possible to display e.g. Programm 1,2,... a bigger type, i mean over 2 lines of the 2x20 display instead of a 8 digit display? No, and yes: You have the possibility to generate custom chars, but as there are only eight chars storeable (0x0 to 0x7). This way you could define different sets of custom chars and swap while displaying, but I fear, that this would be a quite advanced task and I'm not sure if it's possible to swap the charset while being displayed all at once... :-\But MIOS also supports GLCDs (Graphical LCDs); you could customize this freely; but I think there are not so many examples available and I've never worked with GLCDs by myself...You could take a search for Captain Hastings GLCD and CLCD tools here on the forum – and they are linked in the Wiki (appDev -> LCDs), if you're interested.Best regards,Michael Quote
macsurfer6 Posted October 16, 2006 Report Posted October 16, 2006 Hi there,so the box is working fine now.Only the front is still missing.I use a lcd now, it was the easiest way for me but when i have more time i will get back to the digit idea once again.Thanks for your help.See youMicha (had to change to macsurfer6 because of password problems) Quote
audiocommander Posted October 17, 2006 Report Posted October 17, 2006 congratulations you succeeded so fast! :)I think, the LED digits are indeed the best way to go...Cheers,Michael Quote
Sasha Posted October 26, 2006 Report Posted October 26, 2006 macsurfer, what for are you gonna use this box? Quote
macsurfer4 Posted October 27, 2006 Author Report Posted October 27, 2006 The box is for a friend of mine.He is performing live with some orchestral sounds triggered by a midi keyboard.This keyboard has no prg-change function, so he asked me to build a simple Box with buttons.I built the box that he can use it also as a small Midibox 64, the upper 4 buttons and the lcd are for the menu navigation. 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.