[SLAC Controls Software Group [SLAC Controls Department] [SLAC Home Page]

Go to bottom of page



3.1 ABSTRACT: . . . . . . . . . . . . . . . . . . . . 3-1

3.2 PHYSICAL KNOBS -- A HISTORICAL OVERVIEW. . . . . . 3-1

3.3 PICTORIAL DESCRIPTION OF A KNOB: . . . . . . . . . 3-4

3.4 FIRST PASS KNOB GRAPHICS . . . . . . . . . . . . . 3-4

3.5 PRIMARY ATTRIBUTES OF A KNOB: . . . . . . . . . . 3-6

3.6 INFORMATION REQUIRED TO CREATE A KNOB: . . . . . . 3-8

3.6.1 KNOB_SETUP . . . . . . . . . . . . . . . . . . . 3-8

3.6.2 Knob Driver Communications . . . . . . . . . . . 3-9

3.6.3 Assigning A Knob . . . . . . . . . . . . . . . 3-10

3.6.3.1 Panel Assignments: . . . . . . . . . . . . . 3-10

3.6.3.2 Fortran Assignments: . . . . . . . . . . . . 3-11

3.6.4 Typical Driver . . . . . . . . . . . . . . . 3-11

3.7 KNOBS INTERNALS . . . . . . . . . . . . . . . . 3-14

3.7.1 KNOB_ASSIGN . . . . . . . . . . . . . . . . . 3-14

3.7.2 KNOB_DEASSIGN . . . . . . . . . . . . . . . . 3-15

3.7.3 KNOB_RESTORE . . . . . . . . . . . . . . . . . 3-15

3.7.4 KNOB_LEGEND . . . . . . . . . . . . . . . . . 3-16

3.7.5 KNOB_SETUP . . . . . . . . . . . . . . . . . . 3-17

3.7.6 KNOB_UPDATE_LOCAL . . . . . . . . . . . . . . 3-17

3.7.7 KNOB_UPDATE_GLOBAL . . . . . . . . . . . . . . 3-17

3.7.8 KNOB_DRIVER . . . . . . . . . . . . . . . . . 3-18

3.7.9 TPIO Ast Routine . . . . . . . . . . . . . . . 3-19

3.7.10 TPIO Routine . . . . . . . . . . . . . . . . . 3-19

3.7.11 Knob Communications . . . . . . . . . . . . . 3-20

3.8 DISPLAYS . . . . . . . . . . . . . . . . . . . . 3-22

3.8.1 Simple Graphics . . . . . . . . . . . . . . . 3-23

3.8.2 Foreground-Background Graphics . . . . . . . . 3-23

3.8.3 DEXEC Control . . . . . . . . . . . . . . . . 3-24

3.8.4 DISPLINE Routines . . . . . . . . . . . . . . 3-25

3.8.4.1 DISPLINE . . . . . . . . . . . . . . . . . . 3-26

3.8.4.2 DISPLINE_INIT . . . . . . . . . . . . . . . 3-27

3.8.4.3 DISPLINE_SKIP . . . . . . . . . . . . . . . 3-28

3.8.4.4 DISPLINE_PAGE . . . . . . . . . . . . . . . 3-28

3.8.4.5 DISPLINE_STAT . . . . . . . . . . . . . . . 3-28

3.8.5 Additional Display Utilities . . . . . . . . . 3-29

3.8.5.1 Database Single Unit Displays (DSPCATS) . . 3-29

3.8.5.2 HISTO . . . . . . . . . . . . . . . . . . . 3-29

3.8.5.3 STAT_COLOR . . . . . . . . . . . . . . . . . 3-30

3.8.5.4 ZPLOT Utilites . . . . . . . . . . . . . . . 3-30

3.9 COMMUNICATION FROM THE SCP TO A PANEL . . . . . 3-31

3.9.1 PNLWRIT . . . . . . . . . . . . . . . . . . . 3-31

3.9.2 PNLWRIT_SEND . . . . . . . . . . . . . . . . . 3-33

3.9.3 PNLWRIT_BLINK . . . . . . . . . . . . . . . . 3-33

3.10 CURSOR ADDRESSED LIMITED FACILITY (CALF) . . . . 3-34

3.10.1 Functional Description . . . . . . . . . . . . 3-34

3.10.2 Limitations . . . . . . . . . . . . . . . . . 3-38

3.10.3 Programming Notes . . . . . . . . . . . . . . 3-39 CHAPTER 3 KNOB SUPPORT

3.1 ABSTRACT: The new system support for knobs for the SLC Control System allows process variables (ie: Magnet Fields, Klystron Phase) to be controlled from a wide variety of sources. The new knob support ("type-2" knobs) is incorporated into new and existing application knob drivers. Old knobs "type-1" are no longer supported. Design of system knob utility support and the implementation in application driver routines is discussed.

3.2 PHYSICAL KNOBS -- A HISTORICAL OVERVIEW. The two original environments which supported knobs were COWs and CALFs (and PIGs). The COW has a 256 count/turn shaft encoder, while the CALF has a set of Fast/Slow Up/Down buttons. Each application knob driver (type-1) is responsible for all scaling, limits, and labels. Each knob has a 16 character legend, with the last 6 characters reserved for the value (expressed in engineering units). The current knob environment was driven by the needs of the workstation console (WKS). Each knob has a set of ranges, a current value, and a number of display options. The ranges consist of a local "ruler" with higher resolution gradations and an "absolute" ruler with the local range highlighted. An arrow/number points to the current


KNOB SUPPORT Page 3-2 value. There are several knob movement techniques under consideration. The first proposal is supported as part of the initial implementation (the "May-19th" proposal). All movements require the same application support, and the difference is fully supported within the system knob utilities. Knob Movements: i) The the display consist ONLY of labels, the current value and three switches for selecting a "hardware" gain. Since there are no rulers and no arrow, the only part of the display needing updating is the current value. The value is changed by clicking either of two mouse buttons (one for increasing the value, one for decreasing it) in main part of the knob window. ii) The arrow/number is "clicked" to a new position by the mouse and cursor. There is a "redraw" region which repaints the local ruler with the arrow centered. iii) The arrow/number can be "clicked" to a new position, or "clicked-dragged" back and forth. If the cursor leaves the active window, dragging ceases. The redraw option (above) is available. iv) There is a "move up" and a "move down" area defined in the normal windows as described above, which will move the arrow as necessary. The local region will be rescaled as needed automatically if movement is of this nature.
KNOB SUPPORT Page 3-3 v) The knob region is divided in logical areas, low gain on the left, and high gain on the right. Two mouse buttons are used to "click-move" the arrow up/down, and cursor movement is dependent on the cursor's position in the window. The arrow will automatically move, and the local region will be redrawn as necessary.
KNOB SUPPORT Page 3-4

3.3 PICTORIAL DESCRIPTION OF A KNOB: The following is an illustration of the original proposal of the workstation knob. Most of the illustrated features are available with the current version of SLC and DEC window management support. TYPICAL WORKSTATION KNOB. +----+----------------------------------------------+ |Menu| SCP_: | +-+--+--------------------------------------------+-+ | | * 1.534 | | | | V | | |R| |---+---+---+---+---+---+---+---+---+---| |R| | | 1.00 2.00 | | | |-10.00 |------------------###----------| 10.00 | | +-+-----------------------------------------------+-+ ^ | Rescale Region | +-------------------+ (one of two) | Knob Options | +-------------------+ | Push Behind | <-- Pop-Up Menu | Shrink to icon | | Fast forward | | Fast reverse | | Increase gain | | Decrease gain |------------~ | Restore knob |: 3.4 FIRST PASS KNOB GRAPHICS The very first minimal knobs will have no rulers and no rescale regions. The only way to change the value of the knob variable will be with two mouse buttons defined to be "up" and "down" buttons. The


KNOB SUPPORT Page 3-5 graphics will look like this: +----+------------------------------------+ |Menu| | +----+-------------------------------+----+ | |fast| | +----+ | |med | | +----+ | |slow| +------------------------------------+----+ The three square regions to the right will be used to modify the gain. The middle region will be "normal" and the knob will come up with this region highlighted. The upper region will reduce the gain; the lower will increase it. The three possible gain settings (call them "hardware settings" for now) will be multiplied by another (already existing) gain factor which may be set from the application (e.g., from a touchpanel button). For the first pass, it will not be possible for the operator to change the multiplicative factors corresponding to these hardware gains; neither will they be modifiable by the application from program control. A new gain region is selected by clicking the left-most mouse button within the region. This will cause an AST to store the new hardware gain for this knob in an appropriate place and to highlight the region. The large region in the picture above will have attached to it another AST which will be sensitive to clicks of the right-most mouse button (to increase the value of the knob variable by an amount proportional to the product of the hardware gain and the application gain) and the center mouse button (to decrease the value of the knob variable). This AST will store sufficient information for the knob driver to know by what amount the knob has been "rotated" -- it will not attempt any
KNOB SUPPORT Page 3-6 actual change in value or graphics itself -- and will set a flag before returning. A click of the leftmost mouse button in this region will merely pop the window to the front.

3.5 PRIMARY ATTRIBUTES OF A KNOB: The following is a full list of the attributes of a workstation knob. The calling sequence to establish knob-specific contexts (ie: total range) are discussed under "KNOB_SETUP" below. a) Knob ID -- The knob's ID, or number is currently asserted either from the touch panel or hard coded in the knob_assign call (most cases). The following suggestions are presented for thought: o Ignore the explicitly supplied label, and dynamically allocate from the free knob id pool. o Use the dynamically allocated pool iff the knob id is not specified. b) Knob Position -- The position of the knob on the screen is unresolved. The following suggestions are presented for thought: o The position not be under the user's direct program control. The user may, of course, "grab" the knob and put it wherever he desires. o The initial position be computed from the knob number. We might establish a "clear area" of some corner for knob placement. o UIS willing, if there is a "conflict", the system be allowed to find a suitable location. c) Knob Label -- Any label is accepted as part of the knob initialization. The string "KNOB " will be added to the front of the supplied label. d) Ordinate Label -- The descriptor of the units used in the presentation of the scale. e) Current "Value" -- Any value is accepted following a knob click from the driver routine. The arrow is placed over the value returned. If the value is beyond the range of the ruler, then no arrow is drawn, and the rescale option must be requested prior to any accepted "clicks". The value will be displayed. The initial


KNOB SUPPORT Page 3-7 value is part of the knob initialization. f) Current Range -- The current range is the "length" of the ruler displayed in the window. The initial value is part of the knob initialization. Changing the "gain" from the menu will modify the range. g) Current Limits -- The limits will be chosen within the following constraints: o Arrow will be nearly centered on rescale or initialization. o Limits will be bounded by the Absolute Limits. h) Absolute Range and Limits -- The total range available to this knob. The actual range of the device might be different, and those limits will be explicitly checked by each knob driver. The initial value is part of the knob initialization. i) Rescale Region -- Any "click" in the rescale region at the edge will re-scale the window, forcing a new computation of the current limits. j) Menu Options -- The following options might exist for the knob menu. It is understood that the current implementation of UIS does not allow direct manipulation of the menu options, so in that sense, this is a wish list. i: Fast Forward, Fast Reverse -- "Clicking" these entries will be equivalent to "clicking" one current range to the right/left. A rescale is forced, and the request th the knob driver will be bounded by the absolute limits. ii: Increase, Decrease Gain -- "clicking" this will change the gain up/down in steps of 1, 3, 10. The current range and limits are re-computed, and a rescale is forced. iii: Restore Knob -- The knob is "clicked" with the initial position, and a rescale is forced. iv: Deassign Knob -- The knob is deassigned. Any movements of process variables knobbed is not changed. The knob-id is available for other knobs. v: Exit this menu -- Go back to being a knob.
KNOB SUPPORT Page 3-8

3.6 INFORMATION REQUIRED TO CREATE A KNOB: The workstation knobs (as shown above) consist of an arrow which is "clicked" (or "dragged") from one value to another. The user now has available information on the range or gains currently implemented. The type of "knob" supported by the knob utilities (known as "TYPE 2" control) where the knob creation is done with enough information to allow workstation support. A knob becomes "type 2" as a function of the initialization call. A type 2 knob will continue to be supported for the CALF and COW hardware implementations. The actions performed by the type 2 knobs are regulated by an element KNOB.MODE found in the include '(KNOBS_DRIVER)', and are as follows: o KNOB.MODE = KNOB_INIT -- The driver routine is responsible for calling KNOB_SETUP (see below). This call may only be made once, and at init time, and dynamically changes the knob support to the "type 2" control. The knob window (if wks) is drawn, and the legend is computed and painted by the knob utility. o KNOB.MODE = KNOB_ROT -- The knob driver uses a common block array containing the current knob location and figures out the new display coordinate from the knob coordinate. All units are in engineering units. The legend is computed and painted by the knob utility. o KNOB.MODE = KNOB_END -- The knob driver may do something associated with deassigning the knob.

3.6.1 KNOB_SETUP The knob-routines are a bit more demanding of information for the WKS. There will be an initialization routine telling more about the context of each knob. This routine should be called by the driver routine


KNOB SUPPORT Page 3-9 during each assign (KNOB.MODE=KNOB_INIT). The calling structure is of the form: CALL KNOB_SETUP( the following parameters ) Where most of the following parameters are R*4 unless noted. a) KNOB_LABEL (C*(*)) -- The label associated with the knob. The knob utility will add knod-id type information to this. The maximum length is unknown, but will be truncated as required. b) ORDINATE_LABEL (C*(*)) -- The label associated with the current range. No label (literally '') may be supplied, and the use of mixed case (such as 'Volts', 'Nanoseconds', or 'Salary' ) is preferred. c) CURRENT_VALUE -- The starting value in engineering units. d) CURRENT_RANGE -- See above. The "KNOB_GAIN" gain modifier in the /KNOBS/ common block will be applied to the supplied range. e) ABSOLUTE_LOWER -- The lower maximum value. This is ignored for 780 type knobs. f) ABSOLUTE_UPPER -- The upper maximum value. This is ignored for 780 type knobs. g) CLOSURE (C*(*)) -- Special hook for different data types. Closure types of 'PHASE' indicate that +180.00 and -180.00 are the same, and to take some user friendly action on crossing the boundry, and type 'Z8.8' is a special formatting option used for the test knobs on the COW.

3.6.2 Knob Driver Communications The communication between the knob_utility and the drivers will be through the use of a common structure. The include file is accessed by the Fortran-77 command INCLUDE '(KNOBS_DRIVER)' A listing of the include file, with all the control variables follows: C C COMMON BLOCK FOR KNOB COMMUNICATION FOR "TYPE 2" KNOBS C C


KNOB SUPPORT Page 3-10 C note: this MAX is separately defined in KNOBCOMM.TXT C note: these values are also in KNOBS.TXT (intentionally C to avoid both includes in the same module) C INTEGER*4 KNOB_MAX, KNOB_INIT, KNOB_ROT, KNOB_END PARAMETER (KNOB_MAX = 7, ! Maximum Knob number > KNOB_INIT= 1, ! KNOB_ASSIGN CALL > KNOB_ROT = 2, ! KNOB ROTATION CALL > KNOB_END = 0) ! KNOB_DEASSIGN CALL STRUCTURE /KNOB_STRUC/ Integer*4 ID ! The knob ID (0-n) Integer*4 MODE ! KNOB_INIT, etc. Real*4 CURRENT_VALUE ! The "mouse" location Real*4 DISPLAY_VALUE ! The desired "arrow" location Logical*4 RESCALE_FLAG ! Force user to rescale Real*4 LAST_VALUE ! Used to by driver detect conflicts Real*4 CURRENT_RANGE ! The current range END STRUCTURE RECORD /KNOB_STRUC/ KNOB COMMON /KNOB_DRIVER/ KNOB The knob driver routines will be called with no arguments: CALL The application knob driver should gain access to the common block through the indicated include file.

3.6.3 Assigning A Knob Knobs may be assigned either of two ways. The most common method is through panel code (see ASSIGN: in the index). The panel method usually removes the necessity of writing a special routine to call the KNOB_ASSIGN subroutine. Knobs may also be created from inline fortran calls.

3.6.3.1 Panel Assignments: - The driver must be known to the system through a LIST_CALL call. this is done in the sharable image's


KNOB SUPPORT Page 3-11 xxxINIT.FOR or in the users DEVINIT.FOR. The following lines must exist: EXTERNAL TEST_KNOB (or whatever the driver is called) CALL LIST_CALL(TEST_KNOB, 'TESTKNOB') The panel code will assign your knob driver to the indicated knob as requested by the user.

3.6.3.2 Fortran Assignments: - The application routine may request a knob assignment directly through the following protocol: EXTERNAL TEST_KNOB ISS = KNOB_ASSIGN(, TEST_KNOB) The call will directly assign TEST_KNOB as the driver for the knob .

3.6.4 Typical Driver The following is a "typical" knob driver, "type-2". There is no attempt made to represent reality in examples of database use, message service, CAMAC, etc. ********************************************************************** ********************************************************************** SUBROUTINE TEST_KNOB ! ! **MEMBER**=SLCLIBS:somelib ! ! a "typical" knob driver. This is to serve as an example, and parts ! of the routine have been left deliberatly vague. ! ! rkj -- 4/86 ! IMPLICIT NONE


KNOB SUPPORT Page 3-12 ! common block from facility containing primary, micro, unit, etc. INCLUDE '(MY_COMMON)/NOLIST' INCLUDE '(ACNTRL)/NOLIST' INCLUDE '(KNOBS_DRIVER)/NOLIST' ! storage as required to remember attributes of the created knob INTEGER*4 PRIMS(0:KNOB_MAX), MICROS(0:KNOB_MAX), > UNITS(0:KNOB_MAX), ERRORS(0:KNOB_MAX) ! other variables as necessary REAL*4 ABS_LOWER, ABS_UPPER, RANGE, etc. CHARACTER*16 LABEL !--------------------------------------------------------------------- c Global initializations, etc. See note 1. IF (ACNTRL(1) .NE. 0) THEN RETURN ENDIF c Assign the knob IF (KNOB.MODE .EQ. KNOB_INIT) THEN PRIMS(KNOB.ID) = PRIMARY MICROS(KNOB.ID) = MICRO UNITS(KNOB.ID) = UNIT ERRORS(KNOB.ID) = 0 c -- compute the label WRITE(LABEL, '(A4,1X,A4,I5)') PRIMARY, MICRO, UNIT c -- do necessary DBGETS to establish the following: c -- , , , ISS = c -- perhaps fail. See note 2. IF (.NOT. ISS) THEN CALL KNOB_DEASSIGN(KNOB.ID) GOTO 101 ELSE CALL KNOB_SETUP(LABEL, 'Furlongs', CURRENT_VALUE, RANGE, > ABS_LOWER, ABS_UPPER, 'normal') ENDIF c Rotate the knob ELSEIF (KNOB.MODE .EQ. KNOB_ROT) THEN c -- get value out of database, c -- test for a knob conflict. See note 3. IF (VALUE .NE. KNOB.LAST_VALUE) THEN CALL ERR_SEND(xxx_KNOBCONFLICT, PRIMS(KNOB.ID), > MICROS(KNOB.ID), UNITS(KNOB.ID), VALUE) c -- in case of conflict, update current value KNOB.CURRENT_VALUE = VALUE c -- most drivers have display values equal current values KNOB.DISPLAY_VALUE = KNOB.CURRENT_VALUE c -- and return
KNOB SUPPORT Page 3-13 GOTO 100 ENDIF c -- send a update, do some CAMAC, or whatever is appropiate ISS = c -- count errors. See note 2. IF (.NOT. ISS) ERRORS(KNOB.ID) = ERRORS(KNOB.ID) + 1 IF (ERRORS(KNOB.ID) .GT. ) THEN CALL ERR_SEND(, ...) CALL KNOB_DEASSIGN(KNOB.ID) GOTO 101 ENDIF c Clear the knob ELSEIF (KNOB.MODE .EQ. KNOB_END) THEN 101 CONTINUE c -- free whatever resources have been used. c -- most drivers do nothing special here. ENDIF 100 RETURN END ********************************************************************** ********************************************************************** Note 1: For initialization control of routines defined with the LIST_CALL system, see under ACNTRL in the index. Note 2: The call to KNOB_DEASSIGN does not result in this subroutine being called again. Therefore, any exit handling appropiate should now be handled. Note 3: The correct response to a conflict is to update the current and display values, and return. For workstation knobs, the user requested a specific value, and failed (this pass). For cow knobs, there will be a stream of knob requests for as long as the knob is turned, and a missed movement is certainly no worse than the quantum jump associated with the knob conflict.
KNOB SUPPORT Page 3-14

3.7 KNOBS INTERNALS At the heart of the knob utility support is the single proceedure KNOB_DRIVER. KNOB_DRIVER is organized as a state-driven processor, or state machine. Associated with the definition of each knob is the structure element KNOBS().NEXT_MODE, or the next state in the processor. (The typical state is KNOB_NULL, or "do nothing"). The routine KNOB_DRIVER loops through all supported knobs, processing each knob as indicated in the state descriptor KNOBS().NEXT_MODE until the "KNOB_NULL" state is acheived. KNOB_DRIVER is not reentrant , and returns immediately if so called. (As happens during a Knob Deassign called from the application knob driver). All of the higher level utilities execute the following three actions: a) Argument checking. i.e., is the knob number legal? b) Set next state in structure for the knob. c) Call KNOB_DRIVER. The internals of the knob support are not visiable to the applications level knob routine.

3.7.1 KNOB_ASSIGN This routine associates a supplied driver with a knob. The driver is initially called for initialization, routinely during knob movements, and once for the deassign (if the deassign is not initiated by the driver).


KNOB SUPPORT Page 3-15 The states are as follows: o Check arguments o See if knob is currently assigned. o Set knob state to KNOB_END o Call KNOB_DRIVER o Load new driver address o Set knob state to KNOB_INIT o Call KNOB_DRIVER

3.7.2 KNOB_DEASSIGN This routine dis-associates a driver with a knob. The driver is called for any exit handling, if the call to KNOB_DEASSIGN did not originate from the driver. The states are as follows: o Check arguments o Loop through supplied or ALL* knobs o Set knob state to KNOB_END o Call KNOB_DRIVER o Loop through supplied or ALL* knobs o Test all states for KNOB_END o Set state to KNOB_SHORT_END

3.7.3 KNOB_RESTORE This routine restores the position ar a knob to the start value.


KNOB SUPPORT Page 3-16 The states are as follows: o Check arguments o Prompt as necessary for knob number o Restore original value to knob o Set knob state to KNOB_ROT o Call KNOB_DRIVER

3.7.4 KNOB_LEGEND This routine is the routine which has the most workstation dependent behavour. The routine draws the window as necessary, scale factors, current value, etc. For COW's and CALF's, there is just the computation of the 16 character legend from the supplied string and display value. The states are as follows: *** COW's and CALF's o Check arguments o Compute string o Send string to knob-device *** Workstations o No arguments o Do some or all of the following as indicated by the KNOB.MODE and the contents of KNOBS().xxx o Create Window o Fill window o Draw/Move arrow and number o Delete window


KNOB SUPPORT Page 3-17

3.7.5 KNOB_SETUP This routine initializes the knob-specific structures to describe the knob completely to the support routines. The states are as follows: o Check that the calling context is correct o Set knob type to "type-2" o Copy the contextal information to the appropiate common blocks o Apply universal gain-modifier factor to supplied RANGE

3.7.6 KNOB_UPDATE_LOCAL This routine updates the local KNOB structure from the universal knob structures as needed. The states are as follows: o Copy 5 words of data into "KNOB." structure o If knob is "type-1", update /KNOBS/ common block for older routines. o Save a copy of the current value

3.7.7 KNOB_UPDATE_GLOBAL This routine updates the global KNOBS structure from the local knob structure as needed.


KNOB SUPPORT Page 3-18 The states are as follows: o If "type-1", convert /KNOB/KNOB_POS() into Current Value o Copy 3 words of data from "KNOB." structure o If the new current value is different from the previous (see KNOB_UPDATE_LOCAL), update position. (as happens following a knob conflict.

3.7.8 KNOB_DRIVER See introduction to this section for an overview of KNOB_DRIVER. The knob_driver routine supports (or will) the following states of knob activity: a) KNOB_NULL -- The do-nothing state b) KNOB_INIT -- Initialize the knob, call application driver c) KNOB_ROT -- Rotation or new value has occurred. Call application driver. d) KNOB_END -- Deassign the knob, call application driver, delete window or clear legend. e) KNOB_SHORT_END -- Delete the window or clear legend. A knob_deassign has been signaled by the application knob driver. f) KNOB_RESCALE -- Recompute the local scale's location, redraw window. g) KNOB_NEWGAIN -- Recompute the local scale's size, redraw window. The loops and general driver states are as follows: o Clear "Finished" flag o Return if reentrantly called o Loop until "Finished" o Set "Finished flag o Loop over all knobs


KNOB SUPPORT Page 3-19 o Loop until this knob's next state is KNOB_NULL o Service next_mode state, including some of the following: o call KNOB_UPDATE_LOCAL o call o call KNOB_UPDATE_GLOBAL o call KNOB_LEGEND

3.7.9 TPIO Ast Routine This routine is the interrupt handler for the knob-utility. There is almost no computing done at this level, and many activities such as formatted writes are specifically prohibited at this level. The states for this routine are console type dependent, and are as follows: o Integrate "delta" type knob movement into a common block o Save cursor position in the window's local coordinate system o Set a flag describing class of operation in a common block o Set the "some knob activity" flag in a common block o Set the Local Event Flag to signal the scheduling of the TPIO group

3.7.10 TPIO Routine This routine is scheduled as a result of some panel, menu, or knob activity.


KNOB SUPPORT Page 3-20 The states are as follows: o If "some panel activity" flag is set, do something. o If "some knob activity" flag is set, then o Loop over all knobs o Evaluate the type of operation requested (if any) o Update the global structure o Set the knob's next_mode state flag o Call knob_driver o If "some menu activity", ... o etc.

3.7.11 Knob Communications There are a number of include files and common blocks used for internal knob communications. The knobs_driver include is described above. The internal communications is acheived through the include: INCLUDE '(KNOBS_DRIVER)' INCLUDE '(KNOBS)' A listing of the include file, with all the control variables follows: C C COMMON BLOCK FOR KNOB COMMUNICATIONS FOR KNOB UTILITY C C c -- include some "knobs_utility" states c (most states are in KNOBS_DRIVER.TXT) INTEGER*4 KNOB_SHORT_END, KNOB_NULL PARAMETER (KNOB_SHORT_END = 4, > KNOB_NULL = -1 ) INCLUDE '(KNOBS_DRIVER)' 1 C


KNOB SUPPORT Page 3-21 1 C COMMON BLOCK FOR KNOB COMMUNICATION FOR "TYPE 2" KNOBS 1 C 1 C 1 C note: this MAX is separately defined in KNOBCOMM.TXT 1 C note: these values are also in KNOBS.TXT (intentionally 1 C to avoid both includes in the same module) 1 C 1 INTEGER*4 KNOB_MAX, KNOB_INIT, KNOB_ROT, KNOB_END 1 PARAMETER (KNOB_MAX = 7, ! Maximum Knob number 1 > KNOB_INIT= 1, ! KNOB_ASSIGN CALL 1 > KNOB_ROT = 2, ! KNOB ROTATION CALL 1 > KNOB_END = 0) ! KNOB_DEASSIGN CALL 1 1 STRUCTURE /KNOB_STRUC/ 1 Integer*4 ID ! The knob ID (0-n) 1 Integer*4 MODE ! KNOB_INIT, etc. 1 ! the order of these is used in '(KNOBS_UTILITY)' 1 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 Real*4 CURRENT_VALUE ! The "mouse" location 1 Real*4 DISPLAY_VALUE ! The desired "arrow" location 1 Logical*4 RESCALE_FLAG ! Force user to rescale 1 Real*4 LAST_VALUE ! Used to by driver detect conflicts 1 Real*4 CURRENT_RANGE ! The current range 1 END STRUCTURE 1 1 RECORD /KNOB_STRUC/ KNOB 1 COMMON /KNOB_DRIVER/ KNOB 1 1 STRUCTURE /KNOBS_STRUCTURE/ ! the order of these is used in '(KNOBS_DRIVER)' and in KNOB_UPDATE ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Real*4 CURRENT_VALUE ! The "mouse" location Real*4 DISPLAY_VALUE ! The desired "arrow" location Logical*4 RESCALE_FLAG ! Force user to rescale Real*4 LAST_VALUE ! Used to by driver detect conflicts Real*4 CURRENT_RANGE ! The current range ! end of "public" elements ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INTEGER*4 NEXT_MODE ! Next MODE flag INTEGER*4 TYPE ! 1 or 2 REAL*4 POSITION ! Current Position (type 1) REAL*4 START_VALUE ! Used for a knob restore REAL*4 ABSOLUTE_LOWER ! Absolute limits REAL*4 ABSOLUTE_UPPER ! '' '' REAL*4 CURRENT_LOWER ! Current limits REAL*4 CURRENT_UPPER ! '' '' INTEGER*4 DRIVER_ADDRESS ! %LOC() of the knob driver CHARACTER*12 CLOSURE ! Closure type CHARACTER*40 KNOB_LABEL ! Knob label, incl. SCP_ID, etc. CHARACTER*12 ORDINATE_LABEL ! Ordinate value END STRUCTURE RECORD /KNOBS_STRUCTURE/ KNOBS(0:KNOB_MAX) COMMON /KNOBS_UTILITY/ KNOBS VOLATILE /KNOBS_UTILITY/
KNOB SUPPORT Page 3-22 C C This common is a copy of '(KNOBS)', and used for the support of C type 1 knobs. INTEGER*4 KNOB_MODE ! The calling mode for the knob driver INTEGER*4 KNOB_ID ! The ID of the knob INTEGER*4 KNOB_POS(0:KNOB_MAX) ! Knob position REAL*4 KNOB_GAIN ! First time only gain modifier COMMON /KNOBS/ > KNOB_MODE, > KNOB_ID, > KNOB_POS, > KNOB_GAIN

3.8 DISPLAYS Graphic CRT displays, textual lineprinter output, and graphical line printer output are controlled by the Display Executive, DEXEC. DEXEC handles all of the SCP-COW/CALF communication protocol so that the operation of a display subroutine devolves into combinations of calling HANDIPAK display facilities, the DISPLINE facility, and Unified Graphics routines that ADD data to a display buffer. Display routines should include the common block /ACNTRL/. The value of ACNTRL(1) is used to steer the operation of a display. A value of: o -1 indicates initialization. Any first time definition of logical names necessary for panel operation should be made at this point. Note that any extensive operations needed for the display but not needed for the first invocation of the display should be saved for a later call. This allows significantly faster startup of the SCP, particularly relevant since the vast majority of displays will not be used with any single SCP startup.


KNOB SUPPORT Page 3-23 o 0 indicates a request for a graphics display. Note that HANDIPAK and DISPLINE internally interpret ACNTRL(1) and can be called for ACNTRL(1)=0, 1, or 2. o 1 indicates a request to clear a display. This might be a null request depending on context. o 2 indicates a request for a textual lineprinter display or a display that can be formatted for a CALF. The display writer normally satisfies this request with HANDIPAK or DISPLINE, although output produced on Fortran logical unit 6 will normally be displayed.

3.8.1 Simple Graphics A normal display that is doing custom graphics by using the Unified Graphics routines should specify the buffer SCPBUF which is found in the Fortran library member (SCPBUF). All clearing and output control of the buffer is handled by DEXEC.

3.8.2 Foreground-Background Graphics Certain displays may wish to update at relatively high rates to allow real time observation of machine performance; an obvious example is the Beam Position Monitor display. Such displays are optimized by dividing them into background and foreground segments. The background segment is generated once and transmitted once to the COW; subsequently only the foreground segment is generated and transmitted to the COW. The COW performs the erasure of the older foreground


KNOB SUPPORT Page 3-24 segment and the inclusion of the new segment. Thus extremely elaborate backgrounds may be designed for high repetition rate displays without performance penalties. The first step in a foreground-background display is to identify the routine as such to the SCP by adding the parameter DX_BCKG to the GRP_BITS in the LIST_DISP call (See the section on Logical Names). This and the other specialized parameters are defined in (SCPBUF). The display routine when producing graphics (ACNTRL(1)=0) should steer on ACNTRL(2). If this variable is equal to DX_FORE then a foreground display should be generated, and if it is equal to DX_BCKG then the background display should be generated. This origin of the graphics buffer may be always used, but it is not necessary for simple displays.

3.8.3 DEXEC Control All DEXEC options are controlled by the logical name variable DXMODE, which is normally set from a touch panel. The presently supported options are: 1. VERSATEC requests the present graphics display be "copied" from the CRT to the Versatec plotter. 2. PRINT


KNOB SUPPORT Page 3-25 requests lineprinter output and will call displays with ACNTRL(1)=2. 3. ALTDISP requests that the display be routed to an alternate CRT on a COW. Although the standard COW has only one graphics screen, the system can handle additional CRT's. 4. OVERLAY requests that the "existing" display not be erased and the new display be overlayed. A maximum of two display routines may be overlaid. Do not confuse this option with overlays of graphics from a single display routine; ie one routine can make an arbitrary number of calls to the HANDIPAK displays. 5. CLEAR requests that the DEXEC display tables be cleared, thus clearing the CRT to blank. Normally, a display is on the screen until replaced by another. Do not confuse this option with that implied by ACNTRL(1)=1.

3.8.4 DISPLINE Routines Displays consisting entirely of Ascii text are generated using the set of standard DISPLINE routines. These routines format text strings to the COW color monitor, the CALF display area, or the line printer. The position of the string is specified by line and column number and automatic line incrementing and paging is handled internal to the


KNOB SUPPORT Page 3-26 DISPLINE routines.

3.8.4.1 DISPLINE - SUBROUTINE DISPLINE(STRING,COLOR,IX,IY) o STRING is the Character string to be output. o COLOR is the Character string specifying a standard Unified Graphics color which will be interpreted as the COW color or CALF graphic rendition to be used. The correspondence between color and graphic rendition is: White - Normal Green - Bold Yellow - Underscore Blue - Bold-Underscore Magenta - Blink-Underscore Cyan - Reverse Video Red - Blink Reverse Video o IX is an Optional I*4 starting column number (default=DL_X) (n.b. COW scope has 73 characters across) o IY is an Optional I*4 change in row number relative to the last call (default=1); e.g. IY=0 will print on same line as the last call. DISPLINE is the general display routine for outputting character data to the COW scope, CALF terminal, or line printer. It contains provision for automatic line incrementing and paging. After each


KNOB SUPPORT Page 3-27 call, the row number DL_Y is incremented by 1. If the result is greater than DL_LINES, the flag DL_NEW_PAGE is set TRUE, the page DL_PAGE is incremented by 1, and DL_Y is reset to 1. For output to COW or CALF, output occurs only if DL_PAGE=DL_DISP_PAGE. DL_DISP_PAGE may be set in call to DISPLINE_INIT (default=1). This feature is useful in instances where it is difficult to calculate paging structure in advance. In this case one makes calls to DISPLINE for all pages, and only the correct page is actually output.

3.8.4.2 DISPLINE_INIT - ENTRY DISPLINE_INIT(JDPAGE,JX,JY,JPAGE,JLINES,DY) o JDPAGE is the Optional I*4 Page to be output (default 1) If supplied, it MUST be a variable so displine can do paging internally and return calculated page number to caller o JX is the Optional I*4 Starting column number for all output not overridden by argument IY in call to DISPLINE. (Default=1) o JY is the Optional I*4 Line number for next output (Default=1) o JPAGE is the Optional I*4 Page number for next output (Default=1) o JLINES is the Optional I*4 user-supplied Total number of lines per page (Default = 30 for CALF, 40 for COW)


KNOB SUPPORT Page 3-28 o DY is the Optional R*4 user-supplied COW scope line height (row size/screen size) (Default = .025) DISPLINE_INIT initializes a display for subsequent calls to DISPLINE. It must be called once for each display before any text is output. All arguments are optional and over-ride default values put into common block /DSPLNBLK/.

3.8.4.3 DISPLINE_SKIP - ENTRY DISPLINE_SKIP(NSKIP) DISPLINE_SKIP skips NSKIP lines. NSKIP is Optional I*4 and defaults to 1.

3.8.4.4 DISPLINE_PAGE - ENTRY DISPLINE_PAGE DISPLINE_PAGE advances pointers to the next page.

3.8.4.5 DISPLINE_STAT - SUBROUTINE DISPLINE_STAT(STRING,STAT,IX,IY) o STRING is the Character string to be output. o STAT is the I*2 status word to control the color of the display. The low order 4 bits are interpreted as a status summary mask and the output color is chosen by a call to


KNOB SUPPORT Page 3-29 STAT_COLOR. o IX is an Optional I*4 starting column number as in DISPLINE. o IY is an Optional I*4 change in row number as in DISPLINE. DISPLINE_STAT uses DISPLINE to output a line of text with the color chosen according to the low order status bits in STAT.

3.8.5 Additional Display Utilities

3.8.5.1 Database Single Unit Displays (DSPCATS) - SUBROUTINE DSPCATS(MICRO,PRIMARY,UNIT) o MICRO is the I*4 ASCII string containing the Micro name o PRIMARY is the I*4 ASCII string containing the Primary name o UNIT is the I*4 Integer or ASCII string containing the unit number DSPCATS is a standard routine to display all known database information about a given unit specified by Micro, Primary, Unit. An error message is printed if any argument is equal to 'ALL*'. Paging is done internally using the universal panel variable Panl_page.

3.8.5.2 HISTO -


KNOB SUPPORT Page 3-30 SUBROUTINE HISTO HISTO is a driver subroutine which may be called from a Panel to output HANDYPAK histos which have been defined and filled by other user software. If executing on a COW, the histogram goes to the monitor with a call to the normal Handypak HOUT routine. If executing on a CALF, it calls AA_HOUT to put the histogram on the display area of the terminal. The histogram name is selected on the panel and passed to the routine in the variable HISTNAME. It is expected to be only 4 ASCII characters long. If undefined, an error message is printed.

3.8.5.3 STAT_COLOR - CHARACTER*7 FUNCTION STAT_COLOR(STAT) STAT_COLOR is a function to calculate the standard SLC color corresponding to the I*2 status supplied in STAT. Only the lowest 4 bits are used as a mask to determine the color coding as follows: STAT = 4 - Cyan (Offline) = 8 - Red (Sick) = 2 - Yellow (Ok but not good) = 1 - Green (Good) = 0 - White (No status)

3.8.5.4 ZPLOT Utilites -


KNOB SUPPORT Page 3-31 The ZPLOT routines are a set of utility routines designed to facilitate the plotting of database entries as a function of their Z position along the Linac. The routines may also be used to plot simple X,Y co-ord data supplied by the user. A full description of the routines and their calling sequences may be found in the VAXSOFT help library under the subtopic DISPLAYS.

3.9 COMMUNICATION FROM THE SCP TO A PANEL A SCP program may add data to a panel by use of the routine PNLWRIT. This routine adds a user string to a symbolically defined location on the panel. Warning: When initializing a new panel, PNLWRIT can only write to button locations that have been defined on the current or previous lines of the panel definition file.

3.9.1 PNLWRIT PNLWRIT(BTN_NAME_STRING,STRING,LINE,FLAGS) where: BTN_NAME_STRING is a character variable of length le 8 containing the symbolic button location defined by any of the panel commands BUTTON, SWITCH, SELECT, SHADOW, etc.. It is passed by descriptor so Integer or Real variables containing Ascii strings must be passed as %Descr(Var_name). The string '*' selects the current button location as the destination of the output.


KNOB SUPPORT Page 3-32 STRING is character variable containing the ASCII text to be displayed. The length of string is limited only by the scissoring of graphic material that would lie outside the boundaries of the screen image. PNLWRIT does not respect button boundaries (except for line 2 of a CALF where STRING will be truncated to 6 characters), nor does it honor carriage return-line feed sequences. Normal button strings should contain le 6 characters. LINE is an OPTIONAL I*4 variable describing the vertical position of the STRING with respect to the button outline. A button has space for 4 lines; numbered from 1 through 4 and beginning at the top of the outline. If LINE is omitted, it will default to 4. FLAGS is an OPTIONAL Integer*2 variable which allows the user to specify special modes of operation for PNLWRIT. To date two options are available. Depending on the value of FLAGS, PNLWRIT 1. will or won't warn the user if the button specified in BTN_NAME_STRING is not found (default is warn). Normally the default of warn should be used. Nowarn is useful when the routine calling PNLWRIT may justifiably be invoked with the "wrong" panel up. Note: In the special case where the output string is blank or the special COW blank bar character, no warning is issued regardless of FLAGS. 2. will or won't accumulate a series of PNLWRIT messages in a buffer so they can be sent to the graphics device in a single transfer (default is not to accumulate; i.e., each message is sent immediately). Note: when initializing a new panel, everything on the panel is buffered regardless of the FLAGS
KNOB SUPPORT Page 3-33 argument. Users wishing to specify a value for FLAGS other than the default should INCLUDE '(PANEL)', wherein appropriate parameters are defined. For example, if the user wished the output to be buffered, but wants to be warned of a non-existent button, the call would be CALL PNLWRIT(btn-name-string,string,line,PNLWRIT_BUFF)

3.9.2 PNLWRIT_SEND For convenience, an additional routine PNLWRIT_SEND can be used to send a buffer of previously constructed messages to the graphics device. The calling sequence is CALL PNLWRIT_SEND There are no arguments required.

3.9.3 PNLWRIT_BLINK An additional routine PNLWRIT_BLINK is used by the terminal input routines DLOG_* to output a blinking bar to the last line of the current button. The calling sequence is CALL PNLWRIT_BLINK


KNOB SUPPORT Page 3-34 There are no arguments required.

3.10 CURSOR ADDRESSED LIMITED FACILITY (CALF) Because the supply of COWs is limited, and to provide for debugging and remote usage, it is desireable have a single terminal system capable of emulating most of the functions of a COW. The CALF provides this capability, and utilizes the cursor addressing features of the Ann Arbor Ambassador terminal. The system standardizes on the Ann Arbor because of its extensive cursor addressing capabilities and its 60 line screen. If the terminal is equipped with an Ann Arbor Graphics Master unit, the the CALF is converted to Panel Interactive Graphics (PIG).

3.10.1 Functional Description The screen is divided into 4 separate regions: Lines 1/30 are used as the display area, Lines 31/56 are used as the touch panel area, line 57 is used for dialog between user and computer, and lines 58/60 serve as a message area from the VAX. To use the CALF, run the SLC Control Program (SCP) as normal (e.g. command SCP). In response to the prompt for COW ID, type TERMINAL (or any abbreviation thereof) for a CALF or GRAPHICS (or any abbreviation thereof) for a PIG. You can also switch between CALF and PIG mode using PF keys 6 and 7 (see below).


KNOB SUPPORT Page 3-35 To use the CALF touch panel, use the up/down/left/right arrow keys to position the cursor inside the desired button. Pushing ENTER is then the equivalent of pushing a touch panel button. Pushing the HOME key will move the cursor to the nominal INDEX panel position (top right). To use the CALF knobs, first select the desired knob (0-3) by pushing PF(9-12). Note: to prevent accidental knob changing, the knobs are deactivated if no knob activity occurs within 60 seconds, in which case you must reselect the knob. The selected knob will be shown in reverse video on the screen. Assign knobs as usual using the touch panel. The KP7 (T-CLR) key will increase the knob at slow speed, KP1 (SSA) will decrease at slow speed, KP9 (T-SET) will increase at fast speed, and KP3 (ESA) will decrease at fast speed. Because the CALF uses the terminal in cursor addressed mode, the PF keys are used to allow one to switch modes: RESET: Resets Ann Arbor Graphics Master Unit and terminal to power-up conditions (destroys SCP capability). Works only for terminals equipped with Graphics Masters. RESET: Complete Ann Arbor terminal reset, except for programmable keys (use SETUP-Z to get default key settings) and Graphics Master (use RESET for this if you are willing to destroy SCP capability). PRINT: Print the entire screen on terminal printer. PRINT: Print just the display region of the screen. EDIT: Return to Cursor to touchpanel (use after PRINT or PRINT.)
KNOB SUPPORT Page 3-36 INSERT: Print displayed graphics plots on terminal printer ERASE: Clears graphics screen and returns to alphanumeric mode. PF1: Places the top 30 lines of the screen in normal mode while making inaccessable the bottom 30 lines of the screen. This is useful in DEBUG mode, allowing one to converse with the debugger without destroying the touch panel region of the screen. PF2: Places the top 30 lines of the screen in normal mode and erases this section while making inaccessable the bottom 30 lines of the screen. This is useful in DEBUG mode, allowing one to converse with the debugger without destroying the touch panel region of the screen. PF3: Places the screen in cursor addressed mode, restoring any previously saved touch panel. Useful in leaving DEBUG mode and returning to normal program. PF4: Allow SCP global messages to be broadcast to the terminal. (See PF5 below). PF5: Disallow SCP global broadcast messages. Because the message area of the screen is limited, it is sometimes convenient to suppress global messages and limit messages to those unique to the SCP being run. PF6: Enter PIG mode (CALF with graphics) PF7: Enter CALF mode from PIG mode.
KNOB SUPPORT Page 3-37 PF8: Button Macro Abort/Attention. PF9: Activate Knob 0 PF10: Activate Knob 1 PF11: Activate Knob 2 PF12: Activate Knob 3 PF1s: Toggle terminal key click mode. PF2s: Toggle terminal block cursor mode. PF8s: Spawn CATER. KP8(^) : Move cursor up KP2(v) : Move cursor down KP4(<-): Move cursor left KP6(->): Move cursor right ENTER: Activate touch panel button KP7(T-CLR): Knob up slowly KP1(SSA) : Knob down slowly KP9(T-SET): Knob up quickly KP3(ESA) : Knob down quickly Note: By popular demand, the block cursor mode is used to make the cursor easier to find on the touch panel. If this bothers you then use the toggle block cursor mode
KNOB SUPPORT Page 3-38 key (PF2s) to change it.

3.10.2 Limitations 1. Because Ann Arbors without Graphics Masters do not have true graphics capability, displays for CALFS (as opposed to PIGS) are limited to purely alphanumerics (see programming notes below). 2. Because the screen is cursor addressed, one cannot read and write to the CALF as though it were a normal terminal. Hence one must abide by software conventions and use packaged CALF-compatible software. See programming notes below. 3. WARNING!!!! Writing to the terminal in CALF mode (i.e. using escape sequence cursor controls) when a PIG is in graphics mode has catastrophic consequences. As of this writing, global messages are broadcast to the terminal in CALF mode at random times and hence are beyond the control of the SCP program. Hence, until this problem is fixed, DISABLE GLOBAL MESSAGES WHENEVER YOU ARE IN PIG MODE!!!!! 4. Because the CALF Touch panel is squeezed into a small number of lines, there are several limitations on the format of Script messages and Button labels. o The Script options to select LARGE size letters are ignored. Script output to either line 3 or line 4 will be written to line 3.


KNOB SUPPORT Page 3-39 o The Button labels are written in 2 lines of 9 characters each, not 3 lines of 6 characters each as on a COW touch panel. This means that labels formatted to look beautiful on a COW may look rather incomprehensible on a CALF. o The alternate line argument in a call to PNLWRIT causes the output string to be truncated to 6 characters and formatted similarly to the button labels.

3.10.3 Programming Notes 1. In writing error messages and other output to the terminal, one should not write directly to the terminal (since it would then appear at some arbitrary location on the screen), but rather use the routine COWRITE or where logging is desired, the SLC error service. 2. Similarly, one should not read data directly from the terminal but rather should use one of the DLOG_* routines. In addition to being CALF-compatible, these routines are generally more convenient to use than standard FORTRAN WRITE and READ statements. 3. For alphanumeric displays, one should not use the unified graphics routines directly, but rather use the COW/CALF compatible routines of the DISPLINE utility. DISPLINE outputs data using integer column and row numbers, and has some facilities which recognize the difference in screen sizes to make paging easier. (The COW scope is 73 characters x 40 lines; the CALF display area is 80 characters x 30 lines.) DISPLINE also performs automatic line incrementing


KNOB SUPPORT Page 3-40 and is thus somewhat more convenient to use than COUT. Nonetheless one should always bear in mind that the CALF screen size is only 30 lines long. 4. For histograms, the subroutine HISTO provides a COW/CALF independent interface to HOUT. 5. For true graphic displays, one should avoid spending cpu time to prepare non-displayable displays by verifying that the SCP is actually running on a COW or a PIG rather than a CALF. This can be done by calling LOGICAL FUNCTION GRAPHICS() which returns TRUE if the SCP has graphics capability.
 
Go to top of page
Contact (until Aug. 15, 1996): Jeffrey Miller
Owner: Bob Sass

Converted from VAX Runoff output using doc2webset.pl