STRE Prototype SGLB Misc/Class Reference CLAS 354261 Universal Counter ESBR SORD 2 LITO 0 clock input, counter counts on rising edge LITO 0 last state of count input (to detect positive edge) LITO 0 reset input, true input resets based upon count mode LITO 0 rollover limit; store full scale or preset 1 here, based on RO mode LITO 0 /e,Full Scale,Preset 1;Rollover Mode PORD 0 the count is stored here PORD 0 /e,Down,Up;Direction PORD 0 /o,0,32767;Preset 1 PORD 0 /o,0,32767;Preset 2 LITO 0 /e,Zero,Preset 1;Reset mode LITO 2 last state of 'at full scale' output LITO 2 last state of 'at zero' output LITO 2 last state of 'above preset 1' output LITO 2 last state of 'above preset 2' output ESBR SGLB Output/#1 LCON /*+;Output 1 (0 - 32767) ESBR SGLB Output/#2 LCON /*+;Output 2 (0 - 100%) ESBR SGLB Output/#3 LCON /*+;At Full Scale ESBR SGLB Output/#4 LCON /*+;At Zero ESBR SGLB Output/#5 LCON /*+;Above Preset 1 ESBR SGLB Output/#6 LCON /*+;Above Preset 2 ESBR ESTR STRE SGLB Misc/Superclass Reference CLAS 354008 Object ESBR SGLB General/Initialize CMNT Expects: É ¥ inst/É LITO 2 É ¥ 2/inst/É PRIM Stack/Dup down É ¥ 2/inst/2/É LITO 11 É ¥ full scale/2/inst/2/É LITO 2 É ¥ 2/full scale/2/inst/2/É PRIM S_tree/Replace É ¥ inst/2/É PRIM Stack/Over É ¥ 2/inst/2/É LITO 12 É ¥ at zero/2/inst/2/É LITO 2 É ¥ 2/at zero/2/inst/2/É PRIM S_tree/Replace É ¥ inst/2/É PRIM Stack/Over É ¥ 2/inst/2/É LITO 13 É ¥ above preset 1/2/inst/2/É LITO 2 É ¥ 2/above preset 1/2/inst/2/É PRIM S_tree/Replace É ¥ inst/2/É LITO 14 É ¥ above preset 2/inst/2/É LCAL Rollover Input É ¥ É ESBR SGLB R&D/Preset 1 /3v8,-100,100,0,100;Preset 1 (0-100%) CMNT Expects: É ¥ inst/arg/É LITO 8 É ¥ 8/inst/arg/É LCAL Rollover Input É ¥ É ESBR SGLB R&D/Get Preset 1 /2v6,-100,100;%3.2f%% CMNT Expects: É ¥ inst/route/É LITO 8 É ¥ 8/inst/route/É LITO 2 É ¥ 2/8/inst/route/É PRIM S_tree/Read É ¥ ordinal data/inst/route/É LITO 32767 É ¥ 32767/ordinal data/inst/route/É PRIM Misc/Ordinal to value É ¥ value data/inst/route/É PRIM Tags/Set literal É ¥ value data/inst/route/É CALL 354056 Respond withData ESBR SGLB R&D/Preset 2 /3v8,-100,100,0,100;Preset 2 (0-100%) CMNT Expects: É ¥ inst/arg/É LITO 9 É ¥ 9/inst/arg/É LCAL Process Input É ¥ É ESBR SGLB R&D/Get Preset 2 /2v6,-100,100;%3.2f%% CMNT Expects: É ¥ inst/route/É LITO 9 É ¥ 9/inst/route/É LITO 2 É ¥ 2/9/inst/route/É PRIM S_tree/Read É ¥ ordinal data/inst/route/É LITO 32767 É ¥ 32767/ordinal data/inst/route/É PRIM Misc/Ordinal to value É ¥ value data/inst/route/É PRIM Tags/Set literal É ¥ value data/inst/route/É CALL 354056 Respond withData ESBR SGLB R&D/Rollover Mode /3t5,Full Scale,Preset 1;Rollover Mode CMNT Expects: É ¥ inst/arg/É LITO 5 É ¥ 5/inst/arg/É LCAL Rollover Input É ¥ É ESBR SGLB R&D/Get Rollover Mode /2t4,Full Scale,Preset 1 CMNT Expects: É ¥ inst/route/É LITO 5 É ¥ 5/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Reset Mode /3t5,Zero,Preset 1;Reset mode CMNT If false, resets to 0 on RESET. CMNT If True, resets to PRESET 1 on RESET CMNT Expects: É ¥ inst/arg/É LITO 10 É ¥ 10/inst/arg/É CALL 354073 É ¥ É ESBR SGLB R&D/Get Reset Mode /2t4,Zero,Preset 1 CMNT Expects: É ¥ inst/route/É LITO 10 É ¥ 10/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Direction /3t5,Down,Up;Direction CMNT Expects É ¥ inst/arg/É LITO 7 É ¥ 7/inst/arg/É CALL 354073 É ¥ É ESBR SGLB R&D/Get Direction /2t15,Down,Up CMNT Expects: É ¥ inst/route/É LITO 7 É ¥ 7/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Reset /3t5,False,True;Reset CMNT Expects: É ¥ inst/arg/É PRIM Stack/Over É ¥ reset/inst/reset/É LITO 3 É ¥ 3/reset/inst/reset/É LITO 2 É ¥ 2/3/reset/inst/reset/É PRIM S_tree/Replace É ¥ inst/reset/É PRIM Stack/Swap É ¥ reset/inst/É BRFL branch if not requesting reset, just store state PRIM Heap/Store self É ¥ É BRTR CMNT reset is now true, so perform a reset CMNT read Reset Mode. If true, set COUNT to PRESET 1, else to 0. LITO 10 É ¥ 10/inst/É LITO 2 É ¥ 2/10/inst/É PRIM S_tree/Read É ¥ reset mode/inst/É BRFL if false, use 0 for reset count LITO 0 É ¥ 0/inst/É PRIM Stack/Swap É ¥ inst/0/É LITO 6 É ¥ 6/inst/0/É LCAL Process Input É ¥ É BRTR CMNT Reset Mode is TRUE, so store PRESET 1 in COUNT LITO 8 É ¥ 8/inst/É LITO 2 É ¥ 2/8/inst/É PRIM S_tree/Read É ¥ PRESET 1/inst/É PRIM Stack/Swap É ¥ inst/PRESET 1/É LITO 6 É ¥ 6/inst/PRESET 1/É LCAL Process Input É ¥ É ESBR SGLB R&D/Get Reset /2t4,False,True CMNT Expects: É ¥ inst/route/É LITO 3 É ¥ 3/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Clock Input /3t5,False,True;Count Input CMNT Expects: É ¥ inst/arg/É PRIM Stack/Over É ¥ arg/inst/arg/É BRFL if false, nothing to do CMNT if input is low, then just store it and be done. LITO 1 É ¥ 1/inst/arg/É CALL 354073 É ¥ É BRTR LITO 1 É ¥ 1/inst/arg/É LITO 2 É ¥ 2/1/inst/arg/É PRIM S_tree/Read É ¥ last input/inst/arg/É BRFL if last input false (rising edge), then need to count CMNT First store the new count input state. PRIM Stack/Swap É ¥ arg/inst/É LITO 1 É ¥ 1/arg/inst/É LITO 2 É ¥ 2/1/arg/inst/É PRIM S_tree/Replace É ¥ inst/É LITO 3 reset LITO 2 É ¥ 2/7/inst/É PRIM S_tree/Read É ¥ reset/inst/É BRFL process only if reset false LITO 7 direction LITO 2 É ¥ 2/7/inst/É PRIM S_tree/Read É ¥ direction/inst/É BRFL if false, direction is down CMNT here, false, so count down. Get the existing count, and CMNT see if currently at 0. If so, load the number which has CMNT been stored in ROLLOVER. Otherwise, just decrement the count. LITO 6 É ¥ 6/inst/É LITO 2 É ¥ 2/6/inst/É PRIM S_tree/Read É ¥ count/inst/É PRIM Stack/Duplicate É ¥ count/count/inst/É BRFL branch if count is zero (rollover) CMNT load from ROLLOVER PRIM Stack/Drop É ¥ inst/É LITO 4 É ¥ 4/inst/É LITO 2 É ¥ 2/4/inst/É PRIM S_tree/Read É ¥ ROLLOVER/inst/É PRIM Stack/Swap É ¥ inst/ROLLOVER/É LITO 6 É ¥ 6/inst/ROLLOVER/É LCAL Process Input É ¥ É BRTR CMNT Otherwise, not 0, so just decrement the existing count PRIM Ordinal/Decrement É ¥ count-1/inst/É PRIM Stack/Swap É ¥ inst/count-1/É LITO 6 É ¥ 6/inst/count-1/É LCAL Process Input É ¥ É BRTR CMNT Here, direction is TRUE, so must count up. First check to see CMNT if at rollover level, and if so, set count to 0. CMNT Else, simply increment the count. LITO 6 É ¥ 6/inst/É LITO 2 É ¥ 2/6/inst/É PRIM S_tree/Read É ¥ count/inst/É PRIM Stack/Swap É ¥ inst/COUNT/É LITO 4 É ¥ 4/inst/COUNT/É LITO 2 É ¥ 2/4/inst/COUNT/É PRIM S_tree/Read É ¥ ROLLOVER/inst/COUNT/É PRIM Stack/Xswap É ¥ ROLLOVER/COUNT/inst/É PRIM Ordinal/Compare É ¥ result/COUNT/inst/É BRFL if false (COUNT < ROLLOVER), then increment count CMNT counter has not yet reached limit. Just inc it. PRIM Ordinal/Increment É ¥ COUNT+1/inst/É PRIM Stack/Swap É ¥ inst/count+1/É LITO 6 É ¥ 6/inst/count+1/É LCAL Process Input É ¥ É BRTR CMNT counter is at limit. Set it back to 0. PRIM Stack/Drop É ¥ inst/É LITO 0 É ¥ 0/inst/É PRIM Stack/Swap É ¥ inst/0/É LITO 6 É ¥ 6/inst/0/É LCAL Process Input É ¥ É BRTR CMNT in reset, nothing to do. PRIM Heap/Store self É ¥ É BRTR CMNT Here, count input is true, and was true last time, so no CMNT action is necessary, except to clean up the stack, and exit. PRIM Stack/Xdrop É ¥ inst/É PRIM Heap/Store self É ¥ É ESBR SGLB R&D/Get Clock Input /2t4,False,True CMNT Expects: É ¥ inst/route/É LITO 1 É ¥ 1/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Count /3u110,0,32767;Enter Count CMNT Expects: É ¥ inst/arg/É LITO 6 É ¥ 6/inst/arg/É LCAL Process Input É ¥ É ESBR SGLB R&D/Get Count /2u2 CMNT Expects: É ¥ inst/route/É LITO 6 É ¥ 6/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Get Full Scale /2t4,False,True;At Full Scale CMNT Expects: É ¥ inst/route/É LITO 11 É ¥ 11/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Get Zero /2t4,False,True;At Zero CMNT Expects: É ¥ inst/route/É LITO 12 É ¥ 12/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Get Above Preset 1 /2t4,False,True;Above Preset 1 CMNT Expects: É ¥ inst/route/É LITO 13 É ¥ 13/inst/route/É CALL 354072 Method 2 Get ESBR SGLB R&D/Get Above Preset 2 /2t4,False,True;Above Preset 2 CMNT Expects: É ¥ inst/route/É LITO 14 É ¥ 14/inst/route/É CALL 354072 Method 2 Get ESBR ESTR LDEF Process Input CMNT Input: É ¥ offset/inst/dataÉ CMNT Output: É ¥ É PRIM Stack/Xswap É ¥ offset/data/instÉ LITO 2 É ¥ 2/offset/data/instÉ PRIM S_tree/Replace É ¥ inst/É LCAL Do Outputs É ¥ É EDEF LDEF Rollover Input CMNT Input: É ¥ offset/inst/dataÉ CMNT Output: É ¥ É PRIM Stack/Xswap É ¥ offset/data/instÉ LITO 2 É ¥ 2/offset/data/instÉ PRIM S_tree/Replace É ¥ inst/É LCAL setrolim update the rollover limit if rollover mode is true EDEF LDEF setrolim CMNT This reads rollover mode, and sets up the rollover limit CMNT accordingly. CMNT Input: É ¥ inst/É CMNT Output: É ¥ inst/É LITO 32767 É ¥ 32767/inst/É LITO 4 É ¥ 4/32767/inst/É LITO 2 É ¥ 2/4/32767/inst/É CMNT first preset rollover limit to 32767 (assume mode is false) PRIM S_tree/Replace É ¥ inst/É LITO 5 É ¥ 5/inst/É LITO 2 É ¥ 2/5/inst/É PRIM S_tree/Read É ¥ rmode/inst/É BRFL If false, then need fs in roll limit, which is already there LCAL Do Outputs É ¥ É BRTR CMNT Here, the roll mode is true, which means that the rollover CMNT limit must be set to preset 1, instead of 32767 LITO 8 É ¥ 8/inst/É LITO 2 É ¥ 2/8/inst/É PRIM S_tree/Read É ¥ preset 1/inst/É PRIM Stack/Swap É ¥ inst/preset 1/É LITO 4 É ¥ 4/inst/preset 1/É LCAL Process Input É ¥ É EDEF LDEF Do Outputs CMNT Input: É ¥ inst/É CMNT Output: É ¥ inst/É MACR ordinal count output LITO 6 É ¥ 6/inst/É LITO 2 É ¥ 2/6/inst/É PRIM S_tree/Read É ¥ COUNT/inst/É PRIM Stack/Dup down É ¥ COUNT/inst/COUNT/É GSYM Output/#1 É ¥ #1/COUNT/inst/COUNT/É PRIM Misc/Send entry É ¥ inst/COUNT/É EMAC MACR value count output PRIM Stack/Over É ¥ COUNT/inst/COUNT/É CMTL stuff in this comment not needed if full scale = 32767 LITO 32767 É ¥ 32767/COUNT/inst/COUNT/É PRIM Misc/Ordinal to value É ¥ value COUNT/inst/COUNT/É ECMT GSYM Output/#2 É ¥ #2/value COUNT/inst/COUNTÉ PRIM Misc/Send entry É ¥ inst/COUNT/É EMAC LCAL Test Out 3 process at full scale output LCAL Test Out 4 process at zero output LCAL Test Out 5 process above preset 1 output LCAL Test Out 6 process above preset 2 output EDEF LDEF Test Out 3 CMNT Input: É ¥ inst/COUNT/É CMNT Output: É ¥ inst/COUNT/É CMNT CMNT Here the output for full scale is handled. First check to see CMNT what the output should be. Then, if it has changed since last CMNT time, output the new state. CMNT LITO 11 É ¥ 11/inst/COUNT/É LITO 2 É ¥ 2/11/inst/COUNT/É PRIM S_tree/Read É ¥ old/inst/COUNT/É PRIM Stack/Xover É ¥ COUNT/old/inst/COUNT/É LITO 32767 É ¥ 32767/COUNT/old/inst/COUNT/É PRIM Ordinal/Test equal É ¥ new output/COUNT/old/inst/COUNT/É PRIM Stack/Xdrop É ¥ new output/old/inst/COUNT/É PRIM Stack/Swap É ¥ old/new output/inst/COUNT/É PRIM Ordinal/Test equal É ¥ changed/new output/inst/COUNT/É BRFL É ¥ new output/inst/COUNT/É PRIM Stack/Dup down É ¥ output/inst/output/COUNT/É LITO 11 É ¥ 11/output/inst/output/COUNT/É LITO 2 É ¥ 2/11/output/inst/output/COUNT/É PRIM S_tree/Replace É ¥ inst/output/COUNT/É PRIM Stack/Swap É ¥ output/inst/COUNT/É GSYM Output/#3 É ¥ #3/output/inst/COUNT/É PRIM Misc/Send entry É ¥ /inst/COUNT/É BRTR PRIM Stack/Drop É ¥ inst/COUNT/É EDEF LDEF Test Out 4 CMNT Input: É ¥ inst/COUNT/É CMNT Output: É ¥ inst/COUNT/É CMNT CMNT Here the 'At Zero' output is handled. First check to see what CMNT the output should be. Then, if it has changed since last time, CMNT output the new state. CMNT LITO 12 É ¥ 12/inst/COUNT/É LITO 2 É ¥ 2/12/inst/COUNT/É PRIM S_tree/Read É ¥ old/inst/COUNT/É PRIM Stack/Xover É ¥ COUNT/old/inst/COUNT/É PRIM Ordinal/Test zero É ¥ new output/old/inst/COUNT/É PRIM Stack/Swap É ¥ old/new output/inst/COUNT/É PRIM Ordinal/Test equal É ¥ changed/new output/inst/COUNT/É BRFL É ¥ new output/inst/COUNT/É PRIM Stack/Dup down É ¥ output/inst/output/COUNT/É LITO 12 É ¥ 12/output/inst/output/COUNT/É LITO 2 É ¥ 2/12/output/inst/output/COUNT/É PRIM S_tree/Replace É ¥ inst/output/COUNT/É PRIM Stack/Swap É ¥ output/inst/COUNT/É GSYM Output/#4 É ¥ #4/output/inst/COUNTÉ PRIM Misc/Send entry É ¥ /inst/COUNT/É BRTR PRIM Stack/Drop É ¥ inst/COUNT/É EDEF LDEF Test Out 5 CMNT Input: É ¥ inst/COUNT/É CMNT Output: É ¥ inst/COUNT/É CMNT CMNT This is the routine to handle the 'Above Preset 1' output. CMNT The new state of it is computed. If it has changed, the new CMNT state is saved and output. CMNT LITO 8 É ¥ 8/inst/COUNT/É LITO 2 É ¥ 2/8/inst/COUNT/É PRIM S_tree/Read É ¥ PRESET 1/inst/COUNT/É PRIM Stack/Xswap É ¥ PRESET 1/COUNT/inst/É CMNT Will be True if COUNT is >= PRESET 1, which implies that CMNT the output should be set to TRUE. PRIM Ordinal/Compare É ¥ new output/COUNT/inst/É PRIM Stack/Rotate down É ¥ inst/new output/COUNT/É LITO 13 É ¥ 13/inst/new output/COUNT/É LITO 2 É ¥ 2/13/inst/new output/COUNT/É PRIM S_tree/Read É ¥ old output/inst/new output/COUNT/É PRIM Stack/Xswap É ¥ old output/new output/inst/COUNT/É PRIM Ordinal/Test equal É ¥ result/new output/inst/COUNT/É BRFL branch if old != new (output has changed) PRIM Stack/Dup down É ¥ new output 3/inst/new output 3/COUNTÉ LITO 13 É ¥ 13/new output 3/inst/new output 3/COUNTÉ LITO 2 É ¥ 2/13/new output 3/inst/new output 3/COUNTÉ PRIM S_tree/Replace É ¥ inst/new output 3/COUNTÉ PRIM Stack/Swap É ¥ new output 3/inst/COUNTÉ GSYM Output/#5 É ¥ #5/new output 5/inst/COUNTÉ PRIM Misc/Send entry É ¥ inst/COUNTÉ BRTR PRIM Stack/Drop É ¥ inst/COUNT/É EDEF LDEF Test Out 6 CMNT Input: É ¥ inst/COUNT/É CMNT Output: É ¥ É CMNT CMNT This is the routine to handle the 'Above Preset 2' output. CMNT The new state of it is computed. If it has changed, the new CMNT state is saved and output. CMNT LITO 9 É ¥ 9/inst/COUNT/É LITO 2 É ¥ 2/9/inst/COUNT/É PRIM S_tree/Read É ¥ PRESET 2/inst/COUNT/É PRIM Stack/Xswap É ¥ PRESET 2/COUNT/inst/É CMNT Will be True if COUNT is >= PRESET 2, which implies that CMNT the output should be set to TRUE. PRIM Ordinal/Compare É ¥ new output/COUNT/inst/É PRIM Stack/Xdrop É ¥ new output/inst/É PRIM Stack/Swap É ¥ inst/new output/É LITO 14 É ¥ 14/inst/new output/É LITO 2 É ¥ 2/14/inst/new output/É PRIM S_tree/Read É ¥ old output/inst/new output/É PRIM Stack/Xswap É ¥ old output/new output/inst/É PRIM Ordinal/Test equal É ¥ result/new output/inst/É BRFL branch if old != new (output has changed) PRIM Stack/Dup down É ¥ new output/inst/new output/É GSYM Output/#6 É ¥ #6/new output/inst/new output/É PRIM Misc/Send entry É ¥ inst/new output/É LITO 14 É ¥ 14/inst/new output/É CALL 354073 É ¥ É BRTR PRIM Stack/Drop É ¥ inst/É PRIM Heap/Store self É ¥ É EDEF