User:X-BT/7-segment
From #openttdcoop wiki
I know this is not unique, but I just had to make my own train counter with a 7-segment train-LED-display (also made one with signal display, much easier). I hope this might be of help if you want to make your own.
The Display
The display is made with diagonal tracks to avoid CL issues when train is leaving and entering. It also makes the digit correctly oriented on the monitor. The LEDs are connected from both sides, to control both sides of the two way pre-signals. This means that each LED requires both non-inverted and inverted input, and that trains only move when their status changes.
Gate Array
To control the display I use an inverted counter and a huge gate array. This gate array makes an OR comparision of selected outputs from the inverted counter. The array supplies both non-inverted and inverted signals for the display, so there are a total of 14 outputs. To the bottom right I put a template for the array with 2x2 outputs and 1 input. It shows how to connect to make that input turn a LED on (north output) or off (south output). Output signed 'on' is non-inverted and 'off' is inverted. The inverted counter has one or none green outputs, so the transition from one state to the next will be through all outputs red, which is just fine. Both screenshots are taken paused, so the output of the gate array is 4.