# # Counterbox Protocol File # OutTerminator = CR; InTerminator = CR; ReadTimeout = 100; WriteTimeout = 100; ReplyTimeout = 200; LockTimeout = 450; initialise { out "RMT 1"; in; out "ECHO 2"; in "%(\$1MsgTxt)s"; # Clear MsgTxt on Init @mismatch{ exec 'echo "Failed to configure counterbox" && exit(1)'; } } fullReset { out "\%"; wait 5000; } ################################################################################ # Status Variables readStatus { out "RS"; in "%d"; @mismatch{in "%(\$1MsgTxt)s";} } readPresetMonitor { out "PC"; in "%d"; @mismatch{in "%(\$1MsgTxt)s";} } writePresetMonitor { out "PC %d"; @mismatch{in "%(\$1MsgTxt)s";} } ################################################################################ # Count Commands startWithCountPreset { out "MP %d"; in; @mismatch{in "%(\$1MsgTxt)s";} } startWithTimePreset { out "TP %#.2f"; in; @mismatch{in "%(\$1MsgTxt)s";} } pauseCount { out "PS"; in; @mismatch{in "%(\$1MsgTxt)s";} } continueCount { out "CO"; in; @mismatch{in "%(\$1MsgTxt)s";} } stopCount { out "S"; in; @mismatch{in "%(\$1MsgTxt)s";} } setMinRate{ out "DL %(\$1THRESHOLD-MONITOR)d %(\$1THRESHOLD)d"; in; out "DR %(\$1THRESHOLD-MONITOR)d"; in; @mismatch{in "%(\$1MsgTxt)s";} } readMinRate{ out "DR"; in "%(\$1THRESHOLD-MONITOR_RBV)d"; out "DL %(\$1THRESHOLD-MONITOR_RBV)d"; in "%(\$1THRESHOLD_RBV)d"; @mismatch{in "%(\$1MsgTxt)s";} } ################################################################################ # Read Values From Monitors readAll8 { out "RA"; in "%(\$1ELAPSED-TIME)f %(\$1M1)d %(\$1M2)d %(\$1M3)d %(\$1M4)d %(\$1M5)d %(\$1M6)d %(\$1M7)d %(\$1M8)d"; @mismatch{in "%(\$1MsgTxt)s";} } readAll10 { out "RA"; in "%(\$1ELAPSED-TIME)f %(\$1M1)d %(\$1M2)d %(\$1M3)d %(\$1M4)d %(\$1M5)d %(\$1M6)d %(\$1M7)d %(\$1M8)d %(\$1M9)d %(\$1M10)d"; @mismatch{in "%(\$1MsgTxt)s";} } readRate { out "RR \$2"; in "%(\$1R\$2)f"; @mismatch{in "%(\$1MsgTxt)s";} } ################################################################################ # Testing Commands switchTestgenOnOff { out "TG %{off|on}"; @mismatch{in "%(\$1MsgTxt)s";} } # Only suppporting test channel 1 at the moment. (The first argument to TG) setTestSignal { out "TG 1 %(\$1TESTGEN-HIGHRATE)d %(\$1TESTGEN-LOWRATE)d"; @mismatch{in "%(\$1MsgTxt)s";} }