# # Counterbox Protocol File # OutTerminator = CR; InTerminator = CR; ReadTimeout = 100; WriteTimeout = 100; ReplyTimeout = 200; LockTimeout = 450; initialise { out "RMT 1"; # Turn on Remote Control in; out "ECHO 2"; # Ask for reponses 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 \$2 %.3f"; # in; # @mismatch{in "%(\$1MsgTxt)s";} # } # # readMinRate{ # out "DL \$2"; # in "%f"; # @mismatch{in "%(\$1MsgTxt)s";} # } setMinRate{ out "DL %(\$1THRESHOLD-MONITOR_RBV)d %.3f"; in; @mismatch{in "%(\$1MsgTxt)s";} } readMinRate{ out "DL %(\$1THRESHOLD-MONITOR_RBV)d"; in "%f"; @mismatch{in "%(\$1MsgTxt)s";} } setRateMonitor{ out "DR %d"; in; @mismatch{in "%(\$1MsgTxt)s";} } readRateMonitor{ out "DR"; in "%d"; @mismatch{in "%(\$1MsgTxt)s";} } clearTimer{ out "CT"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearChannel{ out "CC \$2"; in; @mismatch{in "%(\$1MsgTxt)s";} } ################################################################################ # Read Values From Monitors readAll4 { out "RA"; in "%(\$1ELAPSED-TIME)f %(\$1M1)d %(\$1M2)d %(\$1M3)d %(\$1M4)d"; @mismatch{in "%(\$1MsgTxt)s";} } 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 "%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";} }