This page presents a project that will build on the project NCE Bus Probe 1 that reads all the activity on an NCE Bus and automatically transfers the messages to a client.
-----------------------------------
The project NCE Bus Probe 1 has captured the messages on the NCE Bus as illustrated in the following diagram
The RS485 interface captures all the activity on the NCE Bus. At this point the software NCE_Bus_Probe will place the address of the message in the variable _ping and the actual message in the variable buffer[9].
The code jumps to the method _output_message(). Currently this method just displays the messages for debugging purposes. The object of this project/page is to develop the code to output the messages to clients.
From the document NCE Cab bus protocol-2006.pdf lists other possible messages:
0xc7 print next 8 chars to 4th line right of LCD (addr = D8h)
0xc6 print next 8 chars to 4th line left of LCD (addr = D0h)
0xc5 print next 8 chars to 3rd line right of LCD (addr= 98h)
0xc4 print next 8 chars to 3rd line left of LCD (addr = 90h)
0xc3 print next 8 chars to 2nd line right of LCD (addr = C8h)
0xc2 print next 8 chars to 2nd line left of LCD (addr = C0h)
0xc1 print next 8 chars to 1st line right of LCD (addr = 88h) Note: this is where the clock prints
0xc0 print next 8 chars to 1st line left LCD (addr = 80h)
Since the messages are 9 bytes long which becomes 10 bytes if the address the included the header file must define a type with 10 parameters. That is
Finally in the header code there will need to be a public method that is used by the client to advise the target destination.
Note the parameter here is the type MessHandler so funcPtr should be a type with 10 parameters
The implementation code must provide the nuts and bolts for the methods declared in the header file.
As noted if the client has not set up this link the code is skipped. That is if the client does not need the messages there will be no issue leaving the feature in the library.
The client or *ino code will need to include a method that will receive the messages and take the required actions. Since at this point the client code is just testing or demonstrating the class/library all it will do is print out the results. The method will be the type NCE_Message( ) with 10 parameters.
The final step is to include in the set up code the method that will point to the above message handler,
bus.setMessHandler(&NCE_Message);
The following test results were obtained using a NCE Twin Probe.
The first three lines are part of the library while the remainder is the output from the method NCE_Message( ).
The above trace is part of the displayed data includes all data captures, messages in the implementation file and client messages.
It is captured with begin(1) in the client code.
After start up the above trace is the client messages only.
It is captured with begin(0) in the client code.
The above messages captured by the client illustrate what is happening on the NCE DCC Twin bus with no additional CABs/Throttles