I went to a preserved railway with a visit to the signal box.
I wondered if I could use a micro controller to dong a bell and repeat the sequence as if the remote box repeated it.
I did a house clearance and acquired a door bell with a good gong.
For my model railway I could use it to pretend to pass on the train to the next block.
It might not be prototypical, but it was good fun to try out.
Press the button as if you are using the bell. It flashes the led and restarted the holdoff timer. When the holdoff timer matures the sequence is repeated. Wait till the sequence ends before using it again.
Hover over the circle to set the duration of the holdoff time. NOTE: click delay, then wait , then press holdoff delay to set holdoff delay.
Lancashire & Yorkshire Railway codes These codes were in use in 1919. Code Meaning 1 Call attention 1-2 Is line clear for branch goods trains? 1-2-2 Is line clear for ballast train or officers' special requiring to stop in section 1-3 Is line clear for branch passenger train? 1-3-1 Is line clear for engine and one or two break vans? 1-3-3 Is line clear for "right away" goods train 1-4 Is line clear for express cattle or express goods train class B? 1-5-5 Shunt train for following train to pass 2 Train entering section 2-1 Train out of section, or obstruction removed and many more....
== Using a PIC Chip. There are two solutions that come to mind. 1) A delay line that echos back what I press. 2) A program to remember the key presses and interval between them, and when I finish play back the sequence. http://www.dougrice.plus.com/hp/Theory/bc001_asm.txt Clear event Add TMtsCount to Queue. TMtsCount incremented each Ts TMbuttonPressed BCF IPbuttonPressEvents, BUTTON_7 BTFSS, dotimeslice, RUN_HOLDOFFTMR CLRF TMtsCount INCF TMtsCount,W CALL QUput CLRF TMtsCount ; Start Hold off Timer ; Restart HoldOfTmr with 50 ticks MOVFW TMholdOffDelayCounterInit MOVWF TMholdOffDelayCounter BSf dotimeslice, RUN_HOLDOFFTMR CALL TMringBell RETURN == Solution 2 - remember keypresses and intervals and play back sequence. processes onKeyPress: Dong bell if timerTicks < MAX add timerTicks to end of queue reset timerTicks onTimer: increment timerTicks if timerTicks < MAX ;--------------------------------------------------------------- ; SEC 1.0 - Variables ;--------------------------------------------------------------- CBLOCK 0x20 ; 7 word queue QU_start ENDC CBLOCK 0x30 dotimeslice RTN1_COUNT JumpTableTemp ; polled input stuff IPnewF IPlastF IPbuttonPressEvents IPbuttonReleaseEvents ; queue variables. QUinPtr QUoutPtr QUtemp ; Timers TMnextDelayCounter ; Hold Off delay TMholdOffDelayCounter ; Hold off count TMholdOffDelayCounterInit ; Hold off count TMringBellDelay ; Hold RingBell Output on for thid delay TMtsCount ; incremented every tick, reset on button press.
This example uses the HTML DOM to assign an "onkeydown" event to an input element.
Press a key inside the text field to set a red background color.
NOTE: The keyboard repeat keys complicate using this as the keydown and key up events are relative to the repeated key emit, not the finger on the key. You can use Mouse over.