This page presents a project that handshakes with the NCE Controller. It simply advises the NCE that there is a device (also known as CAB or Throttle) present on the NCE bus. It will not request any action.
-----------------------------------
The project NCE_Bus_Probe1 has captured the messages on the NCE Bus as illustrated in the following diagram
The RS485 interface will capture 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 will jump to the method _output_message().
NCE_Bus_Probe2 populates the method _output_message() to send the messages to client software. The trace below illustrates the results of NCE_Bus_Probe2 .
At this point the slave controller has done absolutely nothing except monitor the bus activity. In practice for starters the slave needs to let the host know it is present. It will do this by loading information on to the bus following the receipt of its ping address (0x85 used).
The slave responses are the subject of this page.
To date the design is just looping waiting for myaddress. In this example 0x85. Upon receipt of 0x85 it needs to respond to the NCE host.
Initially there will be some initialisation required.
Following this the target (this project) must respond to the NCE with either a "I'm still here" or a command/request that will be the subject of a separate project.
The NCE may or may not send a message to device 0x85. If so the code from the previous projects should handle these messages.
The question will be where the dividing line between the class and the client responsibility is. To assist the client all the initialisation will be performed by the class along with the "I am here" response.
To write to the NCE Bus (RS485) the following two methods will be required
Once the project is attached to the RS485bus the code generates the RS485 Available message.
Upon receipt of myaddress the code sends the message 0x7E 0x7F advising the Host (The NCE Controller) that there is a new device on the bus.
The host then sends the 0xD2 message requesting the type of terminal.
The device sends 'a" to indicate a dumb terminal.
The host then continues pinging all addresses.
The waveforms for the reset actions are shown below.
In detail the top channel shows a 85 ping is received from the NCE Twin, the project responds/transmits with the two bytes and then the NCE Twin sends the message/command/request which by observation may be seen to be 0xD2.
** The NCE TWIN expects two byte commands. In this example 7E requests that the data be displayed and 7F that the loco speed is zero.
The trace shows at the address 0x85 the message I'm here is displayed. The message 0x7D 0x7F is send to the NCE Host.
The next project will include the ability to send alternative messages/requests.
Note that the displayed trace has also captured a broadcast message up datting the Fast Clocl.
No changes to the *.ino were required to test this project. The client code for project 1 is given for convenience.
The project as given will only respond with the message "I'm Here" on every 0x85 ping address.
Following projects will enhance the software to requests actions from the NCE Host
-------------------