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

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