Thomas
1
Hallo!
I need some input for programming.
I want to write a routine for editing same valus, the midi events of a button or poti.
A button has 4 midibytes (controller command, value1, valueOn, valueOff, type)
(if you now the PC1600 from peavey you’ll know what I mean)
it’s looking like this on the display (T==toggle):
old: BE017F01T
new: BE017F01T
Now I want to add a cursor, like
old: BE017F01T
new: BE017F01T
-
(indicating that you edit the lower nipple of the second midi byte)
My current solution is:
old: BE017F01T
new: BE0>1<7F01T
But this looks ugly.
Any Ideas?
mess
2
Hi Thomas,
Maybe this helps:
//set edit cursor
MIOS_LCD_CursorSet(position_to_set_cursor);
MIOS_LCD_Cmd(0x0E);
//hide cursor
MIOS_LCD_Cmd(0x0C);
for more commands for a HD44780 display see:
http://www.geocities.com/dinceraydin/lcd/commands.htm
Michaël
Thomas
3
Thanks, I will try it. I’ve overseen the MIOS_LCD_Cmd function.
does someone know how to make this cursor at the good position ??? it appears on the 4th line (adress 0xc0) on a 4x20 LCD
i can edit the EditBuffer but the cursor don’t want to move :getlost:
_#include \<cmios.h\> #include "chaosmatrix.h" #include "softpanel.h" #include "lcd.h" #include "din.h" #include "midi.h" #include "patchnames.h" #include "memo.h" #include "ui\_patch.h" unsigned char banksaved; unsigned char programsaved; unsigned char saved; static unsigned char cursor; /\* EDIT PAGE 1 [] [] [] [] [] 12345678901234567890 SELECT EDIT GROUP LFO VCA ENV PRTA RMP EDIT PAGE 3 [] [] [] [] [] 12345678901234567890 BNK SAVE PATCH? 0 abcdeghj:00 save EDIT PAGE 2 [] [] [] [] [] 0123567890123567890 uOOO \_\_\_\_\_\_\_\_ \< \> editname save o o \* \* o \*/ //////////////////////////////////////////////////////// // Display for edit //////////////////////////////////////////////////////// void UI\_Display\_Edit (void) { unsigned char i; switch(SoftPanel.Page) { case SOFT\_PAGE1: MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_PATCH].dout\_pin); // off MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_EDIT].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_OSCILLATORS].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_FILTER].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_ENVELOPES].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_KEYBOARD].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_MATRIX].dout\_pin); // on MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_PAGE].dout\_pin); // off MIOS\_LCD\_Clear(); MIOS\_LCD\_CursorSet(0 + LCD\_Offset); MIOS\_LCD\_PrintCString("SELECT EDIT GROUP"); MIOS\_LCD\_CursorSet(64 + LCD\_Offset); MIOS\_LCD\_PrintCString("LFO VCA ENV PRTA RMP"); break; case SOFT\_PAGE3: // save patch to matrix1000 memory if(SoftPanel.IsNewPage) { MIOS\_LCD\_Clear(); MIOS\_LCD\_PrintCString("OSC BEND MODW PORTA"); MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_PATCH].dout\_pin); // off MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_EDIT].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_OSCILLATORS].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_FILTER].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_ENVELOPES].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_KEYBOARD].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_MATRIX].dout\_pin); // off MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_PAGE].dout\_pin); // on MIOS\_LCD\_Clear(); MIOS\_LCD\_CursorSet(0 + LCD\_Offset); MIOS\_LCD\_PrintCString("BNK SAVE PATCH "); MIOS\_LCD\_PrintBCD1(BankNumber); MIOS\_LCD\_PrintBCD2(ProgramNumber); if(ProgramNumber \< 10) { MIOS\_LCD\_CursorSet(16 + LCD\_Offset); MIOS\_LCD\_PrintChar('0'); // place a zero here for values below 10 } saved = 0; } MIOS\_LCD\_CursorSet(64 + LCD\_Offset); MIOS\_LCD\_PrintBCD1(banksaved); MIOS\_LCD\_CursorSet(64+4 + LCD\_Offset); MIOS\_LCD\_PrintCString(PatchNames[banksaved][programsaved]); MIOS\_LCD\_PrintChar(':'); MIOS\_LCD\_PrintBCD2(programsaved); if(programsaved \< 10) { MIOS\_LCD\_CursorSet(64+13 + LCD\_Offset); MIOS\_LCD\_PrintChar('0'); // place a zero here for values below 10 } MIOS\_LCD\_CursorSet(64+16 + LCD\_Offset); if(!saved) MIOS\_LCD\_PrintCString("save"); else MIOS\_LCD\_PrintCString(" "); break; case SOFT\_PAGE2: // name the patch //if(SoftPanel.IsNewPage) //{ /\* EDIT PAGE 2 [] [] [] [] [] 12345678901234567890 uOOO \_\_\_\_\_\_\_\_ \< \> editname save o o \* \* o \*/ MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_PATCH].dout\_pin); // off MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_EDIT].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_OSCILLATORS].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_FILTER].dout\_pin); // on MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_ENVELOPES].dout\_pin); // off MIOS\_DOUT\_PinSet0(DIN\_ConfigMap[DIN\_KEYBOARD].dout\_pin); // off MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_MATRIX].dout\_pin); // on MIOS\_DOUT\_PinSet1(DIN\_ConfigMap[DIN\_PAGE].dout\_pin); // on //1st line MIOS\_LCD\_Clear(); MIOS\_LCD\_CursorSet(1 + LCD\_Offset); MIOS\_LCD\_PrintCString("u"); MIOS\_LCD\_PrintBCD2(uBS\_uBank); MIOS\_LCD\_PrintBCD2(uBS\_uPatch); // place a zero here for values below 10 (bank & patch) : if(uBS\_uBank \< 10){ MIOS\_LCD\_CursorSet(2 + LCD\_Offset); MIOS\_LCD\_PrintChar('0'); } if(uBS\_uPatch \< 10){ MIOS\_LCD\_CursorSet(4 + LCD\_Offset); MIOS\_LCD\_PrintChar('0'); } MIOS\_LCD\_CursorSet(7 + LCD\_Offset); MIOS\_LCD\_PrintCString(":"); // print patch name : MIOS\_LCD\_CursorSet(9 + LCD\_Offset); for(i=0; i\<8; i++){ MIOS\_LCD\_PrintChar(EditBuffer__[i]__); } //cursor //MIOS\_LCD\_CursorSet(cursor + 9 + LCD\_Offset); MIOS\_LCD\_Cmd(0x80 + cursor + 9 + LCD\_Offset); MIOS\_LCD\_Cmd(0x0e); // 2nd line MIOS\_LCD\_CursorSet(65 + LCD\_Offset); MIOS\_LCD\_PrintCString("\<"); MIOS\_LCD\_CursorSet(69 + LCD\_Offset); MIOS\_LCD\_PrintCString("\>"); MIOS\_LCD\_CursorSet(71 + LCD\_Offset); MIOS\_LCD\_PrintCString("EditName SAVE"); break; //} } } //////////////////////////////////////////////////////// // Handle for Edit //////////////////////////////////////////////////////// void UI\_Handle\_Edit(void) { if(SoftPanel.Page == SOFT\_PAGE1){ switch (SoftPanel.Button) { case DIN\_PAGE: SoftPanel.Page = SOFT\_PAGE2; break; } } else if(SoftPanel.Page == SOFT\_PAGE2){ switch (SoftPanel.Button){ case DIN\_PAGE: SoftPanel.Page = SOFT\_PAGE3; break; case SOFT\_EDIT\_1: // "\<" cursor--; MIOS\_LCD\_Cmd(0x10); break; case SOFT\_EDIT\_2: // "\>" cursor++; MIOS\_LCD\_Cmd(0x14); break; case SOFT\_EDIT\_5: Write\_Patch\_To\_BS(uBS\_uBank,uBS\_uPatch); break; case DIN\_EDIT: SoftPanel.Page = SOFT\_PAGE1; break; } //if(SoftPanel.EncoderValue != 0){ // encoder EditBuffer[cursor] += SoftPanel.EncoderValue; if (cursor \> 7) cursor = 0; //} } else{ // page 3 switch (SoftPanel.Button){ case DIN\_PAGE: if(!RefreshSoftPanel) SoftPanel.Page = SOFT\_PAGE1; break; case SOFT\_EDIT\_1: if(!RefreshSoftPanel){ banksaved = banksaved == 0 ? 1 : 0; saved = 0; } break; case SOFT\_EDIT\_5: if(!RefreshSoftPanel){ MIDI\_SavePatch(banksaved, programsaved); saved = 1; } break; case DIN\_EDIT: if(!RefreshSoftPanel) SoftPanel.Page = SOFT\_PAGE1; break; } if(SoftPanel.EncoderValue != 0){ // encoder programsaved += SoftPanel.EncoderValue; if(programsaved \> 99) programsaved = 0; if(programsaved \> 99) programsaved = 99; saved = 0; } // end if encoder } // end else page 2 }_