JMRI and C/MRI node and output addressing

Erik84750 Dec 26, 2021

  1. Erik84750

    Erik84750 TrainBoard Member

    342
    136
    12
    1. JMRI addition of C/MRI node: "Add node" (SMINI), if in the Arduino code: if cmri address = 1, hence JMRI address = 1. Is this correct?

    2. In the table with overview of outputs, addressing is (example) 1001 for node address 1 and the address for bit 0 (for example named "L1"). This for an output (lamp) to bit 0. In Arduino this bit must be mapped to a physical digital I/O pin. Is this correct too?

    3. So, if it were CMRI address 0 (Arduino default for the CMRI.h library) for bit 5 then the table address should be 0006? Is that correct too?

    4. And what if you want to command lamp number 20 (of , for example, node with CMRI address 0) of the possible 24 outputs of an SMINI node? Must that be (in the lamp table) address 0021?
     
    Last edited: Dec 26, 2021
  2. Ash

    Ash TrainBoard Member

    106
    67
    8
    Note that there are 24 inputs -- JMRI numbering 1-24, and 48 outputs JMRI numbering 1-48

    If you are using my sketch (trainboard link),
    a. the first 1-16 outputs are the turnouts 0-15 on the pca9685.
    b. LEDs and other outputs connected to mcp23017 are JMRI numbers 17-32 and 33-48
    c. And the I2C addresses on the modules will need to match the Arduino sketch.
    d. The first mcp23017 is for JMRI inputs 1-16 (17-24 were not used)

    e. In JMRI, node 1 should be in agreement with the Arduino sketch parameter:
    #define CMRI_ADDR 1

    Use the JMRI menu item 485 > List CMRI Assignments -- note the node number drop-down and the selection for input or output.

    In defining the items in JMRI, these details were quite helpful: Expresso Arduino

    You may want to define your LED output bits as turnouts... for historical reasons: https://www.jmri.org/help/en/html/tools/Lights.shtml#what
     
    Erik84750 likes this.
  3. Erik84750

    Erik84750 TrainBoard Member

    342
    136
    12
    Your answer e. validates my assumption #1, thank you.

    Now what about the numbering used by JMRI in the tables? I.e. my questions 2 through 4?

    I notice in your very interesting link that you mention JMRI number assignements: 001 through 048: are these the addresses as shown in the corresponding JMRI tables for node # 1?
     
  4. Ash

    Ash TrainBoard Member

    106
    67
    8
    For Node 1, I have numbering CT1001-CT1048 and CS1001-CS1016
    -- turnouts in CT1001-CT1016; LEDs or digital outputs CT1017-CT1048
    -- sensors in CS1001-CS1016

    For Node 2, I have numbering CT2001-CT2048 and CS2001-CS2016
    -- turnouts in CT2001-CT2016; LEDs or digital outputs CT2017-CT2048
    -- sensors in CS2001-CS2016

    It is easy to get off by 1, whether you are looking at nodes or pins. Set up a few to confirm that it works the way you think it should, and rework as needed. Perhaps you can use the JMRI sequential numbering. Regardless of whether I am using all the pins, I define them all in JMRI. Then I am able to toggle adjacent buttons in JMRI should I have connected to a different pin than expected. And a newly connected accessory is already in the JMRI table.
     
    Erik84750 likes this.

Share This Page