# # SinqDAQ 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 DAQ" && 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 pauseCount { out "PS"; in; @mismatch{in "%(\$1MsgTxt)s";} } continueCount { out "CO"; in; @mismatch{in "%(\$1MsgTxt)s";} } stopCount { out "S"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearTimer{ # We first stop the count, as otherwise the 2nd Gen Data Acquisition starts # counting again if a time preset was set. Not a problem with the older boxes stopCount; out "CT"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearChannel{ out "CC \$2"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearCounter4 { out "CC 1"; in; out "CC 2"; in; out "CC 3"; in; out "CC 4"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearCounter8 { out "CC 5"; in; out "CC 6"; in; out "CC 7"; in; out "CC 8"; in; @mismatch{in "%(\$1MsgTxt)s";} } clearCounter10 { out "CC 9"; in; out "CC 10"; in; @mismatch{in "%(\$1MsgTxt)s";} } startWithCountPreset { out "MP %d"; in; @mismatch{in "%(\$1MsgTxt)s";} } startWithTimePreset { out "TP %#.2f"; in; @mismatch{in "%(\$1MsgTxt)s";} } setMinRate{ out "DL \$2 %.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";} } ################################################################################ # 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"; # At least on the sinqtest variant this is broken # requiring channels 9 and 10 to be manually queried out "RC 9"; in "%(\$1M9)d"; out "RC 10"; in "%(\$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";} } ################################################################################ # Gating Settings getGateStatus { out "GT \$2"; in "%d %(\$1GATE-\$2-TRIG_RBV)d"; @mismatch{in "%(\$1MsgTxt)s";} } setGateStatus { extrainput = ignore; out "GT \$2 %(\$1GATE-\$2-ENABLE)d %(\$1GATE-\$2-TRIG)d"; in "Gate \$2"; @mismatch{in "%(\$1MsgTxt)s";} } setGate { out "GATE \$2 %d"; in ""; @mismatch{in "%(\$1MsgTxt)s";} } ################################################################################ # TODO To clean startWithCountPreset4 { clearTimer; clearCounter4; readAll4; startWithCountPreset; } startWithCountPreset8 { clearTimer; clearCounter4; clearCounter8; readAll8; startWithCountPreset; } startWithCountPreset10 { clearTimer; clearCounter4; clearCounter8; clearCounter10; readAll10; startWithCountPreset; } startWithTimePreset4 { clearTimer; clearCounter4; readAll4; startWithTimePreset; } startWithTimePreset8 { clearTimer; clearCounter4; clearCounter8; readAll8; startWithTimePreset; } startWithTimePreset10 { clearTimer; clearCounter4; clearCounter8; clearCounter10; readAll10; startWithTimePreset; }