MRBus modules incorporating APB logic
I developed some modules which are based on my APB signaling logic.
Currently the following exist:
- an APB/CTC Hold signal
- a CTC control point with APB functionality
In order to compile you will also need the MRBus bus files, located in the Download section of the Signaling page here.
Note: All this program code is not really meant to be usable 1-to-1, but rather to give a good starting point to adapt a certain module to your specific needs. In nearly all cases, the version posted is an implementation for a certain situation on my layout, and might not fit yours. This is especially true for in- and output. If you need to change a module but don't know how, write to me explaining the problem and I'll see what I can do for you.
Notes on the detection circuits
Train detection is accomplished with Nathan Holmes's current sensing detector. Additionally, there is a coded infrared reflection sensor (I use IS471F) at each block boundary mounted in between the rails. This allows secure detection of non-current-drawing rolling stock. If you don't think you need this feature, you can leave it out by either pulling the respective input pins on the controller to a HIGH state, or modifying the source code. Occupancy is typically handled at the beginning of the while(1) loop.
Notes on controllers and compiler
The whole software of this project runs on 8-bit Atmel AVR devices. It is written in C and was compiled with avr-gcc, which is included in the great WinAVR toolchain (available at http://winavr.sourceforge.net).