Jump to content

understanding the .ngc code


ssp
 Share

Recommended Posts

Hi ssp,

 

Two things:

First, you need to change the id of the second controller:
 

# Bank 1
EVENT_AINSER id=1 hw_id =1 bank=1 fwd_to_lcd=1 type=CC chn=1 cc=16 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR1 #%3i %3d@(2:1:2)%B"

#Bank 2
EVENT_AINSER id=1001 hw_id =1 bank=2 fwd_to_lcd=1 type=CC chn=1 cc=17 range=0:127 offset=0 lcd_pos=2:1:1 label="FDR2 #%3i %3d@(2:1:2)%B"

Otherwise, Midibox might get confused, all EVENT_xxx must have a unique id. Unless they are of different types.

for example you can have EVENT_LED id=1 and EVENT_AINSER id=1

 

Second:

To light an led for each bank you need the button that sets the bank to forward info to the respective LED.

for example:
 

# select Bank1 directly
EVENT_BUTTON id=1 fwd_id= LED:1 type=Meta meta=SetBank button_mode=OnOnly range=1:1

# select Bank2 directly
EVENT_BUTTON id=2 fwd_id= LED:2 type=Meta meta=SetBank button_mode=OnOnly range=2:2

#LEDS EVENTS

EVENT_LED id= 1 range= 1:1 radio_group= 1

EVENT_LED id= 2 range= 2:2 radio_group=1 

 

The radio group makes sure only one LED turns on I also put the switches in the same radio_group on my config, but i'm not certain it's mandatory.

now, i didn't use cycle_bank, inc_bank or dec_bank

 

but you can take a look at those examples config to see if you find something interesting:

https://github.com/midibox/mios32/tree/master/apps/controllers/midibox_ng_v1/cfg/tests

 

And also, i found usefull to add

 

#initialize all banks to 1

    log "call bank 1 for all parameters"
    set ^bank 1

 

to the section 0 of my .ngr script. this ensure that all parameters are set to bank 1 at startup.

 

  • Like 1
Link to comment
Share on other sites

Thanks Thomas, The fwd_led i tried earlier but it wasn't playing ball for me.

The build will have an dec bank and inc bank pair of buttons, with the leds above them 16 mini leds in all, this is just to give visual info on which one is selected. to sweep the cc# from 0:127 I will just use a single encoder.

I have all of this working all bar the dec-inc leds so i will give this a try again, if no joy i will check the rats nest incase something is astray.

Thanks as always.

Link to comment
Share on other sites

So 16 banks in total, right?

I'll will try something...

 

After a bit of head scratching and a few glasses of rhums, here you go:


 

first the .ngc :

EVENT_BUTTON id= 1  type= Meta meta= DecBank meta= RunSection:1 button_mode= OnOnly   #Bank decrease
EVENT_BUTTON id= 2  type= Meta meta= IncBank meta= RunSection:1 button_mode= OnOnly   #Bank increase

EVENT_LED id= 1 range= 1:1 radio_group= 1 #bank1

EVENT_LED id= 2 range= 2:2 radio_group= 1 #bank2

EVENT_LED id= 3 range= 3:3 radio_group= 1 #bank3

EVENT_LED id= 4 range= 4:4 radio_group= 4 #bank4

 

now for the .ngr :
 

####### Section 0 #######

  if ^section == 0

    log "running section0"

    #initialize all banks to 1

    log "call bank 1 for all parameters"
    set ^bank 1


    exit
  endif
#########################


########## Section 1 ###########
  #tests for the current bank and lights the corresponding LED


  if ^section == 1
    if ^bank == 1
      log "bank 1 selected"
      set LED:1 1
      
    elseif ^bank == 2
      log "bank 2 selected"
      set LED:2 2
      
    elseif ^bank == 3
      log "bank 3 selected"
      set LED:3 3
      
    elseif ^bank == 4
      log "bank 4 selected"
      set LED:4 4
      
    endif
    exit
  endif
################################

 

I hope it works for you, at least, it behaves as wanted here.

 

 

 

Edited by totoRaymond
  • Like 1
Link to comment
Share on other sites

Question:

On the Ainser64 info page it states that more than 2 ainser64 can be used: (i want to have 3 ainser64 connected using their own power feed in rather than from the core)

Multiple MBHP_AINSER64 (or MBHP_AINSER8) modules are connected to J19 in parallel, and accessed by strobing dedicated chip select lines. J19 provides two chip selects (called "RC1" and "RC2"), if more modules should be scanned, common IO pins could be used for the same purpose (e.g. available at J5). To programmers: alternatively, AINSER64 modules could be chained, or a 3-to-8 MUX could be used for accessing 8 modules via 3 IO pins of the microcontroller.

Does the underlined statement refer to j5a and j5b on the core board?

Would i need to edit the mios for this or just the NGC file? I cannot find an example or any info for this.

Thanks

 

 

Edited by ssp
Link to comment
Share on other sites

53 minutes ago, totoRaymond said:

Hi ssp!

 

Yes, this means that if you want more than 2 AINSER, you need to modify the code. and that you might use some unused IO pins on the J5A and J5B connectors.

 

Cheers,

 

Thomas

 

 

Hi Thomas the only thing i can find that maybe along those lines is this thread from fantomxr but this is for ainser8

 

I know nothing about this code or how to edit or compile I am afraid, so any pointers or help etc would be welcome for me.

little bits make sense but I am no coder I am afraid.

Edited by ssp
Link to comment
Share on other sites

Currently here : https://github.com/midibox/mios32/tree/master/apps/tutorials/005_polling_j5_pins

before i go ZZZzz is this the right section to read through ( going to print it out if it is and mark things as I go ) to try and learn how to use the other pins, or do I need to look at other sections of code as well?  The info i pasted above from Ucapps page doesn't really go into anything and it wasn't followed up.

 

in github there is this for the Ain module:

https://github.com/midibox/mios32/tree/master/apps/tutorials/012_ain_muxed

however for the ainsermuxed: https://github.com/midibox/mios32/tree/master/apps/tutorials/012b_ainser_muxed

there is nothing in there.

I would really like to learn how to edit the pins on j5 to add ainser64's and compile etc.

Thanks.

Edited by ssp
Link to comment
Share on other sites

11 hours ago, totoRaymond said:

Hi ssp,

 

I can't really help you with these problems, I might probably tinker with the code someday, but I don't have time to dig into this right now.

thats ok Thomas ;)

For now i will just bank things now i know how to, i need to learn a bit more about code writing etc before i jump into editing it. I am going to go through some of the tutorials in github and try a few other things out. there may be questions about code along the way, but only once i have written or edited things to try.

 

Thanks again

Link to comment
Share on other sites

  • 1 month later...

edit update:

Managed to get the NG working with my XVA1 today, had a few issues with the crappy chinesium midi cable interface thingy, its in the bin now. used teh GM5x5x5 and all worked first time.

working on using sys-ex with it, found an old post in the forum to help me with the sys-ex streams

really love the .NG

Edited by ssp
Link to comment
Share on other sites

question!!

so on my ng core i have set the core to have its own name and gave it a device id=127 (random pick)

when i attach it to the pc it is picked up as normal however, when i then attach my gm5x5x5 to the computer all the ports are the same name

xv1.JPG.42f8a41f2b48ba64e276b922e34ae63d.JPG

 

if i plug in the gm5x5x5 first then the midibox ng it make all the ports the same as the ng core

xv.JPG.487b0ef56fd35bb65735803a2db3ffd4.JPG

 

how do i resolve this any ideas?  I have msg'd nils so waiting for  some info ( hopefully)

 

 

Update: solved found the info in the gm5 page at the bottom, good ol' Nils ;)

 

Q: I want to use two GM5 modules for getting 10 MIDI IO ports, how can I give them individual names?
A: Break the bridge at J8 of the PCB with a small screwdriver, so that IC2:IO4 is not connected to ground anymore. This selects the ploytec.com VID, so that your operating system can differ between two devices (midibox.org and ploytec.com) and installs an individual .inf file.

 

Edited by ssp
solved
Link to comment
Share on other sites

  • 5 months later...

Nice to be back in the forum after work life got in the way and things had to change!

Bought my cnc machine from work along with the laster system, just finished re-wiring it and fitting new cable chains, new power chassis for the main drive system.

I used to use it for making pcbs and enclosures and faceplates so good to have this for use now.

Dug my projects out and looking forward to finishing them finally over the winter months, no questions from me, just time to get on with things!

Link to comment
Share on other sites

  • 1 year later...

Back in the land of buildz.

 

Using the above code I have modified it so that using two buttons i can move up and down the 3 digit displays and using a single encoder change the values.

i am using this just or dec and inc through the 3 digit displays

When i press the button it doesnt display the correct text on the main lcd display until i move the encoder.

EVENT_ENC id=1  hw_id= 1 bank= 1 fwd_id=LED_MATRIX:1 type=CC chn= 1 cc= 16 range=0:127 fwd_id=SENDER:1
EVENT_ENC id=2  hw_id= 1 bank= 2 fwd_id=LED_MATRIX:4 type=CC chn= 1 cc= 17 range=0:127 fwd_id=SENDER:2
EVENT_ENC id=3  hw_id= 1 bank= 3 fwd_id=LED_MATRIX:4 type=CC chn= 1 cc= 18 range=0:127 fwd_id=SENDER:3

 

here is the dout code, you can see where i am forwarding to the lcd underlined text. it forwards the map for -99 to 99 and the label to the lcd

EVENT_BUTTON id= 1  type= Meta meta= DecBank meta= RunSection:1 button_mode= OnOnly   #Bank decrease
EVENT_BUTTON id= 2  type= Meta meta= IncBank meta= RunSection:1 button_mode= OnOnly   #Bank increase

EVENT_SENDER id=1 fwd_id=LED_MATRIX:1 range=map1
EVENT_SENDER id=2 fwd_id=LED_MATRIX:4 range=map1
EVENT_SENDER id=3 fwd_id=LED_MATRIX:17 range=map1

# First Value (3 digits) received via CC#16
EVENT_LED_MATRIX id=1  fwd_id=LED_MATRIX:2  led_matrix_pattern=Digit1  range=-99:99  fwd_to_lcd=1 lcd_pos=1:1:2  label="LFO FREQ:%3d"
EVENT_LED_MATRIX id=2  fwd_id=LED_MATRIX:3  led_matrix_pattern=Digit2  range=-99:99
EVENT_LED_MATRIX id=3                       led_matrix_pattern=Digit3  range=-99:99

# Second Value (3 digits) received via CC#17
EVENT_LED_MATRIX id=4  fwd_id=LED_MATRIX:5  led_matrix_pattern=Digit1  range=-99:99  fwd_to_lcd=1  lcd_pos=1:1:2  label="LFO RES:%3d%B"
EVENT_LED_MATRIX id=5  fwd_id=LED_MATRIX:6  led_matrix_pattern=Digit2  range=-99:99
EVENT_LED_MATRIX id=6                       led_matrix_pattern=Digit3  range=-99:99

# Third Value (3 digits) received via CC#18
EVENT_LED_MATRIX id=17  fwd_id=LED_MATRIX:18  led_matrix_pattern=Digit1  range=-99:99  fwd_to_lcd=1  lcd_pos=1:1:2  label="LFO MODE:%3d%B"
EVENT_LED_MATRIX id=18  fwd_id=LED_MATRIX:19  led_matrix_pattern=Digit2  range=-99:99
EVENT_LED_MATRIX id=19   

is there a way i can when i press the + button that it changes the text to the text that is mapped eg:

first 3 digits called "lfo freq"

second called " lfo res"

third called "lfo mode"

on boot up its set to show lfo freq, if i then press the + button it shows "lfo res" on the display rather than changing it when i move the encoder, if i press + again lfo mode, then the same going back down etc. also a third button that just when pressed goes to the first or home which is the first 3 digits "lfo freq".

 

do i alter the ngc or ngr?

 

the ngr here was used to light up an led for each bank i dont need that to happen now.

 

####### Section 0 #######

  if ^section == 0

    log "running section0"

    #initialize all banks to 1

    log "call bank 1 for all parameters"
    set ^bank 1


    exit
  endif
#########################


########## Section 1 ###########
  #tests for the current bank and lights the corresponding LED


  if ^section == 1
    if ^bank == 1
      log "bank 1 selected"
      set LED:1 1
      
    elseif ^bank == 2
      log "bank 2 selected"
      set LED:2 2
      
    elseif ^bank == 3
      log "bank 3 selected"
      set LED:3 3
      
    elseif ^bank == 4
      log "bank 4 selected"
      set LED:4 4
      
    endif
    exit
  endif
################################

 

will try more tomorrow but a pointer is always appreciated. thanks.

Edited by ssp
Link to comment
Share on other sites

  • 5 weeks later...

can you call "labels" from a map?

 

rather than using this label="LFO FREQ:%3d"

can you have it call the label from a map and when the button is pressed it displays this label rather than waiting for you to say turn the encoder then it displays the label?

Link to comment
Share on other sites

14 hours ago, totoRaymond said:

Hi ssp,

I don't remember if labels can be called from a map, but i don't think so.

 

However, i think it is possible to change the display using a .ngr script.

 

Bests

 

Thomas

Thanks for the pointer Thomas, I did look through the info and the Label section, nothing there to show mapping labels.

I will have another read through the Ngr docs this week and try things this weekend when I am off work.

 

Thanks again

Link to comment
Share on other sites

Hi,

Actually no, the command should be something like:

 

LCD "@(1:1:1)LFO Freq %3d"


but i think it would then display the value sent when script session is called, there might be a way to display another value, but i dont' know how.

 

Alternatively you could use the TRIGGER EVENT function. It should update the display according to your EVENT label settings but also send the associated MIDI message.

 

Bests,

 

Thomas

Link to comment
Share on other sites

  • 1 month later...

After playing around with the code it looks like what i am after cant be done, it's ok not an issue as i will be labeling everything anyway.

today i finished the build on the MIDI_IO module, got it connected and after setting up a button as a note and defining the ports it worked fine sending out a midi to my XV1A synth build

Now everything is running its time to work on the eurorack style control faceplates

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...