Jump to content

understanding the .ngc code


ssp
 Share

Recommended Posts

Hello

You can do it this way:

event_button id=1 fwd_id=sender:1 range=0:127 button_mode=toggle

event_sender hw_id=1 id=1000 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x10 0xf7" if_equal=0

event_sender hw_id=1 id=1001 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7" if_equal=127

Best

Zam

  • Like 1
Link to comment
Share on other sites

20 minutes ago, Zam said:

Hello

You can do it this way:


event_button id=1 fwd_id=sender:1 range=0:127 button_mode=toggle

event_sender hw_id=1 id=1000 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x10 0xf7" if_equal=0

event_sender hw_id=1 id=1001 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7" if_equal=127

Best

Zam

Hey many thanks Zam, I hadn't got the the event_sender section yet, I will go through it now and get some lines down to try this week.

I am still hoping thorsten come in to let me know about the sysex from my daw to the oled, The code is amazing and I understand a lot of it, for me its just a couple of functions that have been asked about before but have never been answered or havent been followed up on.

The code above is really clear in its function for me and i can apply this method for other things as i go and make changes.

By the way I really liked thy automation system you made for your console, really good.

Link to comment
Share on other sites

let me know if this is correct

event_button id=1 fwd_id=sender:1 range=0:127 button_mode=toggle

event_sender hw_id=1 id=1000 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x10 0xf7" if_equal=0

event_sender hw_id=1 id=1001 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7" if_equal=127

ok so looking at this

event_button id=1  #This is the event (button press) id=1 this is the first button on shift register 1=D0
 
fwd_id=sender:1 #this forwards the event_button id

range=0:127 #midi value range

button_mode=toggle #button type


event_sender hw_id=1 #this is the event id that was forwarded to the sender

id=1001  #this gives the event an id (could this be a number say 01 then the second 02?)

fwd_id=led:1 this turns on the dout led 1 on shift register pin 1

type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7"  # this is the transmitted sysex stream

if_equal=127  # this is the on off state of the toggle button either off=0 or on=127

Link to comment
Share on other sites

So using bome's midi translator it shows this string

# when you move to another channel from the one you are on

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4E 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4F 7F
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4A 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4D 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4B 00

# This is the string to select the channel

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 18 7F ( sysex header= F0 00 01 06 16 )

# This is the string when you deselect

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 18 00

# Now we select a different channel:

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 03 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4E 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4F 7F
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4A 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4D 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4B 00

# This is the select string

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 19 7F

# This is the string when you deselect this channel

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 19 00

 

# And once again when you move to the previous channel

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4E 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4F 7F
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4A 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4D 00
MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 4B 00

# The first channel that was selected

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 18 7F

 

# And deselect as before

MIDI IN [Bome MIDI Translator 1 Virtual In]: 90 18 00 

 

 

Link to comment
Share on other sites

Hello

If you need more toggle steps use a map for value

MAP 1 2 3 4

in event button range=map1 the button value will toggle 1,2,3,4,1,2,3......

and 4 sender with contitional if_equal=1.... if_equal=4

 

i think i made a mistake you have to separate the fwd_id led (otherwise led will get the sysex and not the button value)


 

event_button id=1 fwd_id=sender:1 range=0:127 button_mode=toggle

event_sender hw_id=1 id=1000 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x10 0xf7" if_equal=0

event_sender hw_id=1 id=1001 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7" if_equal=127

event_sender hw_id=1 id=1002 fwd_id=led:1:0 if_equal=0

event_sender hw_id=1 id=1003 fwd_id=led:1:1 if_equal=127

Best

Zam

Edited by Zam
Link to comment
Share on other sites

1 hour ago, ssp said:

let me know if this is correct

event_button id=1 fwd_id=sender:1 range=0:127 button_mode=toggle

event_sender hw_id=1 id=1000 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x10 0xf7" if_equal=0

event_sender hw_id=1 id=1001 fwd_id=led:1 type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7" if_equal=127

ok so looking at this

event_button id=1  #This is the event (button press) id=1 this is the first button on shift register 1=D0
 
fwd_id=sender:1 #this forwards the event_button id  no!!! it forward the button value to the sender event with hw_id 1

range=0:127 #midi value range

button_mode=toggle #button type


event_sender hw_id=1 #this is the event id that was forwarded to the sender NO this is the sender event with his ID

id=1001  #this gives the event an id (could this be a number say 01 then the second 02?)

Have a look at id= and hw_id= there is difference

when using same hw_id you better use id out of the hardware range (1-256) to a avoid cross forwarding because an event without hw_id definition with take the id definition as hw_id too

then it's up to your logic to choose a comprehensive patern

fwd_id=led:1 this turns on the dout led 1 on shift register pin 1

type=SysEx stream="0xf0 0x00 0x01 0x16 0xE0 0x18 0x01 0xf7"  # this is the transmitted sysex stream

if_equal=127  # this is the on off state of the toggle button either off=0 or on=127

This is the input condition for the sender to be active, meaning sending the sysex

Best

Zam

Edited by Zam
Link to comment
Share on other sites

Hi,

finally found time to go through this thread... ;-)

First of all: the SysEx string contains an "illegal" value: 0xE0
Values >= 80 should not be sent, because they will be interpreted as a new MIDI status.

Second: you could simply toggle between the two values 0x10 and 0x01, and insert it into the SysEx string via ^val:

EVENT_BUTTON id=1 range=0x10:0x01 button_mode=toggle type=SysEx stream="0xf0 0x00 0x01 0x16 0x10 0x18 ^val 0xf7"

Best Regards, Thorsten. 

Link to comment
Share on other sites

Thanks for calling ini TK

Im learning a lot in a short time so yep I am making the odd mistake here and there , but i have everything written down as well. Lots of things to try next week when its all assembled and put together.

The guys have been just nudging me in the right direction rather than all out doing it for me which is great as it is making me think.

 

here is a screen shot of bome translator capturing the commands from the daw software.

lots to try out, but you can see the captured events on the left in the translator on the right

 

bome screen.jpg

Link to comment
Share on other sites

Just now, TK. said:

Hi,

finally found time to go through this thread... ;-)

First of all: the SysEx string contains an "illegal" value: 0xE0
Values >= 80 should not be sent, because they will be interpreted as a new MIDI status.

Second: you could simply toggle between the two values 0x10 and 0x01, and insert it into the SysEx string via ^val:


EVENT_BUTTON id=1 range=0x10:0x01 button_mode=toggle type=SysEx stream="0xf0 0x00 0x01 0x16 0x10 0x18 ^val 0xf7"

Best Regards, Thorsten. 

The event 0xE0 was a misstype by me sorry about that, this was basically an example sysex string not the actual string

 

As much as i thought i had learned i see there is still a lot more to learn!! man next week is going to be crazy!

Edited by ssp
Link to comment
Share on other sites

Finished building the first mb_mf NG and hooked up a fader, all worked first time. Calibration is great through mios studio. Would have been great if it had the ability to have a lcd attached. Just waiting for the other pcbs to arrive now so I can get on with the ngc code learnings and trial!!

Link to comment
Share on other sites

Thorsten I was wondering if the issue of receiving sysex channel names forwarded to the oled had been resolved? I did ask this in relation to a thread where it had been asked a few years ago.  The channel name is sent from my daw via sysex and the text is ascii converted to hex as explained in this thread. Can you update me on this or if it is possible? Thanks

Link to comment
Share on other sites

Could you please provide a link to the details?

Here an example how text messages can be received and forwarded to a LCD:

EVENT_RECEIVER id=  1 \
               type=SysEx stream="0xf0 0x11 0x22 0x33 0x44 ^cursor ^txt"

A more complex example (defining individual cursor positions) in the Logic Control Template:

# LCD Messages
# Note: we use ^txt56 instead of ^txt, so that the cursor will jump 
#       to the next line after the 56th character has been reached
#       Use map=1 to map the cursor positions over a 2x80 LCD
EVENT_RECEIVER id=  5 \
               type=SysEx stream="0xf0 0x00 0x00 0x66 ^dev 0x12 ^cursor ^txt56" \
               range=map1

# X cursor positions are defined in MAP1
# spread message over two 2x40 LCDs
MAP1   2  3  4  5  6  7  8 \
      12 13 14 15 16 17 18 \
      22 23 24 25 26 27 28 \
      32 33 34 35 36 37 38 \
      42 43 44 45 46 47 48 \
      52 53 54 55 56 57 58 \
      62 63 64 65 66 67 68 \
      72 73 74 75 76 77 78

If this doesn't work for you, I might add an firmware enhancement - but in this case I need concrete information about the content of the SysEx string.

Best Regards, Thorsten.

Link to comment
Share on other sites

On 26/11/2019 at 8:24 PM, ssp said:

Hi THorsten, this is the reference to the hex to oled.

 

F0 00 01 06 16 12 00 00 00 73 74 72 69 6E 67 73 F7

this hex is an example ascii for the track name "strings": 73 74 72 69 6E 67 73

 

Also with regards to the small SSD1306 displays, the software i use uses sysex to talk to them,

here is the sysex from the midi implementation section of the manual

Value Bar Received:

B0, 3i, vv i Value bar number (0 thru 7) vv value (0 to 7F)

B0, 3i, mm i Value bar number offset by 8 (8 thru 15) mm Value bar mode (0: normal, 1: bipolar, 2: fill, 3: spread, 4: off)

B0, 4i, vv i Value bar number (0 thru 7) for strip 9-16 vv value (0 to 7F)

B0, 4i, mm i Value bar number (8 thru 15) for strip 9-16 mm Value bare mode (0: normal, 1: bipolar, 2: fill, 3: spread, 4: off)

Scribble Strips

Addressing: Scribble Strip ID and Scribble Strip Line via SysEx:

Received:

Set Mode:

<SysExHdr> 13, xx, mn F7

xx = scribble strip id 0-7

m = bits 6 to 4 

• bit 4 = 0 - do not clear the strings/ redraw old strings in new mode

[<SysExHdr> 0x13, 0x01, 0x05 F7] - Changes display mode to Mode 5 and redraw old strings in new mode

• bit 4 = 1 - clear strings / new strings will be send and drawn in new mode [<SysExHdr> 0x13, 0x01,0x12 F7] - Changes display mode to Mode 2 and clears the old strings for Scribble Strip #1)

• bit 5 = unused • bit 6 = unused n = mode number (bits 3 to 0) 

 

Send String:

Send the text messages to the scribble strips. Received: <SysExHdr> 12, xx, yy, zz, tx,tx,tx,... F7

xx = scribble strip id 0-7

yy = line number 0-3

zz = alignment flag and normal/inverted

• flag bits xxxxiaa (0000000 = centered normal)

aa = alignment (center: 0, left: 1, right: 2)

i = inverted

x = not used

tx = text in ASCII format

Metering

Channel Pressure message (After Touch) for the peak and reduction meters.

Received:

Dn, vv

n meter address

• 0-7 peak meters 1-8

• 9-15 reduction meters 1-8

vv meter value (0...7F)

Peak meters decay automatically.

Reduction meters are set by the host only (no automatic decay).

Program Change message for the peak and reduction meters 9-16.

Cn, vv

n meter address

• 0-7 peak meters strip 9-16

• 9-15 reduction meters strip 9-16 vv meter value (0...7F)

Peak meters decay automatically. 100% decay in 1.8 seconds.

Reduction meters are set by the host only (no automatic decay).

Running Status The following message is should be sent every second: A0,00,0

 

scribble.jpg

 

Link to comment
Share on other sites

I am just looking at whatever is the most time efficient solution for you if the software needs changing.

the ability to have this sysex:  F0 00 01 06 16 12 00 00 00 73 74 72 69 6E 67 73 F7   this hex is an example ascii for the track name "strings": 73 74 72 69 6E 67 73 show on the oled is all i am looking for.

in an old thread someone asked you about sysex being used for a track name : 

If there is a solution to the track name then I can work out how to do the level, pan etc in my own time as it is a starting point for me.

 

Many thanks

Link to comment
Share on other sites

On 14/12/2019 at 7:01 PM, TK. said:

It would be too much effort to provide a 1:1 compliant solution.

Would it be sufficient if I provide new markers to address the display, and to set the Y position? (something like ^lcd and ^cursor_y)?

Best Regards, Thorsten.

lets put this in anyway as it will be good to learn how to implement this and I would like to see this function in the code. The only way to learn is to do and I really want to get into the ngc code over the winter here.

As I get to grips I will share on this thread.

Thanks Thorsten

Link to comment
Share on other sites

  • 2 weeks later...

right my Board: MBHP_CORE_STM32F4 is working and mios sees it. I have hooked an lcd up to it but im getting no response on the lcd, its lit up and i have trimmed the pots for contrast and backlight.

 

The connection is one to one as per the info I have just checked the data sheet on the lcd (2x40) and it is fine, the ribbon cable is also tested and fine.

I just checked the new lcd on a core and thats fine, but all i am getting are lit squares, so I am assuming it is because i have not defined the LCD as below

the information says that i need to tell it what lcd it is in the bootloader as per this section.

These parameters can be customized from the MIOS Terminal (part of MIOS Studio) by uploading the mios32_bootloader update application

What bootloader update application????

i find this example:

Example2: two HD44780 based 2x40 character LCDs are connected to your MIDIbox
Enter:

     lcd_type CLCD
     lcd_num_x 2
     lcd_num_y 1
     lcd_width 40
     lcd_height 2
     store

So as I am using a single 2x40 i would apply this:

Example2: two HD44780 based 2x40 character LCDs are connected to your MIDIbox
Enter:

     lcd_type CLCD
     lcd_num_x 1
     lcd_num_y 1
     lcd_width 40
     lcd_height 2
     store

 

Where and how would I apply this??

the information is really sketchy and I plan on updating things as i go, right now I am MB_NG newbie 101

 

Thanks

Link to comment
Share on other sites

Bootloader is here:
http://ucapps.de/mios32/mios32_bootloader_v1_018.zip

Upload as normal hex through MIOS Studio and change the LCD type + store as you note above.

Also check that the jumper is set to the correct voltage for your LCD and that the cable is correctly "mirrored" probably by soldering the pinheader onto the back of the display and connecting the IDC there.

Merry Xmas,
Andy

Link to comment
Share on other sites

i had the bootloader in etc already so for the fact im seem to have total loss of brain power where do i enter the lcd type etc?

 

mios gives me this

Operating System: MIOS32
Board: MBHP_CORE_STM32F4
Core Family: STM32F4xx
Chip ID: 0x10076413
Serial: #57003D001050484E52353320
Flash Memory Size: 1048576 bytes
RAM Size: 196608 bytes
Bootloader 1.018
(C) 2014 T.Klose

 

so its good

 

how where to enter the lcd info?

 

Thanks, and merry xmas to you too!!

 

Link to comment
Share on other sites

ok i have that sent now

[11445.498] set lcd_type clcd
[11446.590] LCD type set to 0x00 (CLCD) after 'store'!
[11462.502] set lcd_num_x 1
[11463.594] LCD num_x set to 1 after 'store'!
[11472.272] set lcd_num_y 1
[11473.364] LCD num_y set to 1 after 'store'!
[11480.739] set lcd_width 40
[11481.830] LCD width set to 40 after 'store'!
[11490.256] set lcd_height 2
[11491.348] LCD height set to 2 after 'store'!
[11492.037] store
[11493.571] Failed to store new settings - retry #1
[11493.571] New settings stored.
[11493.571] Initialize LCD #1

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...