CMRI response

I've used CMRI for quite a while now, but must admit that I do not understand how it works.
The following short sketch is part of a much larger one, but I just want to test the handshake between the Arduino and CMRI.

#include <CMRI.h>
CMRI cmri; // address 0, 24 inputs, 48 outputs
boolean tstLight = true;

void setup() {
Serial.begin(9600,SERIAL_8N2);
int hs = 0; // handshake
int b = 0; // blink

while (hs != 1) {
cmri.process();
hs = cmri.get_bit(23); // JMRI reset light turns this on
cmri.set_bit(b, tstLight); // step thru 12 sensors and blink
b +=1;
if (b> 12) {
b = 0;
tstLight = !tstLight;
}
}

cmri.process(); // doesn't work with or without this line
tstLight = true;
cmri.set_bit(16,tstLight); // turn off reset
digitalWrite(13,1);
}

void loop() {
// put your main code here, to run repeatedly:
}

The while loop flashes sensors on the JMRI panel and waits for a reset light on the panel to be clicked.
But the last cmri.set_bit never arrives at JMRI.
Why do the first 12 sensors work, but once a bit is received, the final set_bit doesn't?

AFAIK "JMRI" is a system for controlling model trains. But what is "CMRI"?

Can you post a link to its user manual?

...R

"Computer Model Railroad Interface"

You can get manuals here: http://jlcenterprises.net/

"C/MRI has been adopted as the CMRInet Protocol by the NMRA as Layout Control Specification LCS-9.10.1 dated December 2014." Find that specification here: http://www.nmra.org/sites/default/files/standards/sandrp/Other_Specifications/lcs-9.10.1_cmrinet_v1.1.pdf

@johnwasser, Thank you for the link. I was rather hoping the OP would take the trouble to provide it.

It looks like it should be easy to interface with that protocol using an Arduino. I have built a very similar system for communication between a Python program on my PC and an Arduino.

@GordB, the PDF does not seem to describe the Arduino library you are using. Perhaps you can post a link to its documentation.

...R

Problem solved - pilot error, as usual. The communications were working, but my logix (sic - that's what JMRI calls it) at he receiving end
was faulty.