Skip to content
Tcl Source Code Artifact [8629a46611]
Login

Artifact [8629a46611]

Artifact 8629a46611a44d4eec20e7dc497e64839db46ea2c9ca99459b9aca67a5ae4f57:

Ticket change [8629a46611] - Ticket [6a61b9d61492a249|6a61b9d614] <i>fileevent command missing &quot;exception&quot; as acceptable watchMask</i> status still Open with 4 other changes by davygrvy on 2026-06-18 18:21:37.
D 2026-06-18T18:21:37.670
J icomment Just\ssome\smore\sdetail\sabout\sGPIB.\s\sIt\sis\sa\sdifferent\sbeast\scompared\sto\sa\sTCP\sstream\sand\sI\struly\sneed\san\sexception\sscript\sto\smanage\sthe\s1980s-era\shardware\sI'm\stalking\swith.\r\n\r\n[The\sTheory\sof\sSerial\sPolling](https://www.ni.com/en/support/documentation/supplemental/06/serial-polling-and-srq-servicing-with-ni-488-2-software-and-labv.html#section-392030912)\r\n\r\n><em>"Because\sthese\sbit\sdefinitions\sare\snot\sconsistent\samong\sinstrument\svendors,\sthe\smethod\sfor\sdetermining\sthe\scause\sof\sa\sservice\srequest\svaries\swith\seach\sdevice."</em>\r\n\r\nAn\sexample\sof\smy\suse\swould\sbe\sthe\sfollowing:\r\n\r\n```\r\n\s#\sSet\sup\sthe\sexception\sscript\sto\smanage\sSTB\sfrom\sthe\sincoming\r\n\s#\sSRQ/RQS\salerts\son\sthe\sbus.\r\n\s#\r\n\sfileevent\s$dmm\sexception\s\\\r\n\s\s\s\s\s\s\s\s[list\sdmm_stb\s$dmm\s[subst\s-noc\s{[fconfigure\s$dmm\s-pop_stb]}]]\r\n\r\n\s#\sOur\sexception\s(STB\s-\sstatus\sbyte)\shandler\sscript\r\n\s#\r\n\sproc\sdmm_stb\s{chan\sstb}\s{\r\n\r\n\s\s\s\s#\sSplit\sthe\sSTB\sbyte\sinto\sthe\sinformational\scomponents\sas\sdescribed\son\r\n\s\s\s\s#\spage\s3-24\sof\sthe\sTektronix\sDM\s5010\smanual\r\n\s\s\s\s#\shttps://w140.com/tekwiki/images/5/5e/070-2994-01.pdf\r\n\s\s\s\s#\r\n\s\s\s\sbinary\sscan\s[binary\sformat\sc\s$stb]\sB8\sbstr\r\n\s\s\s\slassign\s[list\s[string\sindex\s$bstr\s0]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\sindex\s$bstr\s1]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\sindex\s$bstr\s2]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\sindex\s$bstr\s3]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\srange\s$bstr\s4\send]]\sclass\sRQS\sabnormal\sbusy\sevent\r\n\r\n\s\s\s\s#\sIgnore\s$RQS\sas\swe\salready\sknow\sthis\swill\sbe\sset,\sas\sthis\sis\swhere\swe\r\n\s\s\s\s#\scame\sfrom\sas\san\sSPOLL\sresponse\sto\sthe\sSRQ\sinterrupt\sthat\shas\snow\r\n\s\s\s\s#\sbeen\scleared.\r\n\r\n\s\s\s\sif\s{$class}\s{\r\n\s\s\s\s\s\s\s\s#\sDEVICE\sSTATUS\r\n\r\n\s\s\s\s\s\s\s\s#\ssplit\sevent\sbits\r\n\s\s\s\s\s\s\s\slassign\s[list\s[string\sindex\s$event\s0]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\sindex\s$event\s1]\s\\\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s[string\srange\s$event\s2\send]]\strigger\sreadable\sstatusCode\r\n\r\n\s\s\s\s\s\s\s\s#\salert\sfor\sa\sreadable\scondition\sinterrupt\shappens\shere\r\n\s\s\s\s\s\s\s\sif\s{$readable}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\sacv\s[format\s%f\s[string\strimright\s[read\s$chan]\s{;}]]\r\n\s\s\s\s\s\s\s\s\s\s\s\sputs\s">DM5010:\s${acv}\sVrms"\r\n\s\s\s\s\s\s\s\s}\r\n\r\n\s\s\s\s\s\s\s\s#\sfall\sthrough\s->\r\n\r\n\s\s\s\s\s\s\s\s#\s$trigger\sis\savailable,\sbut\sserves\sno\spurpose\sfor\sus\shere.\r\n\s\s\s\s\s\s\s\s#\sMaybe\suntrigger\snow\sbecause\swe\sgot\sa\sreadable\snotification,\stoo?\r\n\r\n\s\s\s\s\s\s\s\sset\scode\s[expr\s"0b$statusCode"]\s\s\s\s;#\s[scan]\sdoesn't\sdo\sthis\r\n\s\s\s\s\s\s\s\sswitch\s--\s$code\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s0\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s#no\serrors\sor\sevents\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\s1\s{puts\s">DM5010:\sBelow\slimits\sdevice\sstatus"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s3\s{puts\s">DM5010:\sAbove\slimits\sdevice\sstatus"}\r\n\s\s\s\s\s\s\s\s\s\s\s\sdefault\s{\sputs\s">DM5010:\sUnhandled\sdevice\sstatus\scode:\s$code"\s}\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s}\selse\s{\r\n\s\s\s\s\s\s\s\s#\sEVENT\sCLASS\r\n\r\n\s\s\s\s\s\s\s\sif\s{$abnormal}\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s#\sask\swhat\serror\r\n\s\s\s\s\s\s\s\s\s\s\s\sputs\s$chan\s{err?}\r\n\s\s\s\s\s\s\s\s\s\s\s\sset\serrCode\s[string\strimright\s[read\s$chan]\s{;}]\r\n\r\n\s\s\s\s\s\s\s\s\s\s\s\sswitch\s--\s$errCode\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s101\s{set\serr\s"Invalid\scommand\sheader"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s102\s{set\serr\s"Header\sdelimiter\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s103\s{set\serr\s"Argument\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s104\s{set\serr\s"Argument\sdelimiter\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s106\s{set\serr\s"Missing\sargument"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s107\s{set\serr\s"Invalid\smessage\sunit\sdelimiter"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s201\s{set\serr\s"Not\sexecutable\sin\slocal\smode"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s202\s{set\serr\s"Settings\slost\sdue\sto\sRTL"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s203\s{set\serr\s"Input\sand\soutput\sbuffers\sfull"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s205\s{set\serr\s"Argument\sout\sof\srange"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s206\s{set\serr\s"Group\sExecute\sTrigger\signored"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s231\s{set\serr\s"Not\sin\scalibrate\smode"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s232\s{set\serr\s"Beyond\scalibration\sor\snull\scapability"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s301\s{set\serr\s"Interrupt\sfault"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s302\s{set\serr\s"System\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s303\s{set\serr\s"Math\spack\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s311\s{set\serr\s"Converter\stime-out"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s317\s{set\serr\s"Front\spanel\stime-out"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s318\s{set\serr\s"Bad\sohms\scalibration\sconstant"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s351\s{set\serr\s"Calibration\schecksum\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sdefault\s{set\serr\s"Unknown\sinstrument\serror"}\r\n\s\s\s\s\s\s\s\s\s\s\s\s}\r\n\s\s\s\s\s\s\s\s\s\s\s\sputs\s">DM5010:\sERROR\s$errCode:\s$err"\r\n\s\s\s\s\s\s\s\s\s\s\s\sreturn\r\n\s\s\s\s\s\s\s\s}\r\n\r\n\s\s\s\s\s\s\s\s#\snormal\sevents\r\n\r\n\s\s\s\s\s\s\s\s#\s$busy\swould\sindicate\sthe\smessage\sprocessor\sis\sin\sa\sbusy\r\n\s\s\s\s\s\s\s\s#\sstate,\sat\sthe\smoment.\s\sWhy\swould\swe\scare\sto\sknow?\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\sset\scode\s[expr\s"0b$event"]\s\s\s\s;#\s[scan]\sdoesn't\sdo\sthis\r\n\s\s\s\s\s\s\s\s\r\n\s\s\s\s\s\s\s\sswitch\s--\s$code\s{\r\n\s\s\s\s\s\s\s\s\s\s\s\s1\s{puts\s">DM5010:\sPower-on\sinitialization\sdetected.";\sdmm_init\s$chan}\r\n\s\s\s\s\s\s\s\s\s\s\s\s2\s{puts\s">DM5010:\sOperation\scomplete."}\r\n\s\s\s\s\s\s\s\s\s\s\s\s3\s{puts\s">DM5010:\sYou\spressed\sthe\s'inst\sid'\skey."}\r\n\s\s\s\s\s\s\s\s\s\s\s\s6\s{puts\s">DM5010:\sOver-range\scondition\sdetected."}\r\n\s\s\s\s\s\s\s\s\s\s\s\sdefault\s{\sputs\s">DM5010:\sUnhandled\snormal\sevent\scode:\s$code"\s}\r\n\s\s\s\s\s\s\s\s}\r\n\s\s\s\s}\r\n\s}\r\n```
J login davygrvy
J mimetype text/x-markdown
J username davygrvy
K 6a61b9d61492a249009d231f362c7a8589552565
U davygrvy
Z 1cd908dcbeb111975e863b88fe7b3c66