Difference between revisions of "RRM 3-14 Multi-Bit Binary Output"

From EPICSWIKI
(Fix SHFT table row)
 
(2 intermediate revisions by 2 users not shown)
Line 5: Line 5:




The normal use for the mbbo record type is to send a binary value (representing one of up to 16 states) to a Digital Output module. It is used for any device that uses more than one bit to control it. The mbbo record can also be used to write discrete values to other records via database or channel access links.
The normal use for the mbbo record type is to send a binary value (representing one of up to 16 states) to a Digital Output module. It is used for any device that uses more than one contiguous bit to control it. The mbbo record can also be used to write discrete values to other records via database or channel access links.


== Parameter Fields ==
== Parameter Fields ==
Line 33: Line 33:
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TD>OMSL<TD>Output Mode Select<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>OMSL<TD>Output Mode Select<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>DOL<TD>Desired Output Location (an Input Link)<TD>INLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>DOL<TD>Desired Output Location (an Input Link)<TD>INLINK<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>VAL<TD>Value Field<TD>ENUM<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes
<TD>VAL<TD>Value Field<TD>ENUM<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes
</TABLE>
</TABLE>
Line 55: Line 55:
<TABLE BORDER="1">
<TABLE BORDER="1">
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TD>OUT<TD>Output Link<TD>OUTLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>OUT<TD>Output Link<TD>OUTLINK<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>DTYP<TD>Device Type<TD>DEVCHOICE<TD>Yes<TD>0<TD>Yes<TD>No<TD>No<TD>&nbsp;<TR>
<TD>DTYP<TD>Device Type<TD>DEVCHOICE<TD>Yes<TD>0<TD>Yes<TD>No<TD>No<TD>&nbsp;<TR>
<TD>RVAL<TD>Raw Data Value<TD>ULONG<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes<TR>
<TD>RVAL<TD>Raw Data Value<TD>ULONG<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes<TR>
<TD>SHFT<TD>Shift<TD>USHORT<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>SHFT<TD>Shift<TD>USHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SDEF<TD>States Defined?<TD>SHORT<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>SDEF<TD>States Defined?<TD>SHORT<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>ZRVL<TD>Zero Value<TD>ULONG<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>Yes<TR>
<TD>ZRVL<TD>Zero Value<TD>ULONG<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>Yes<TR>
Line 179: Line 179:
<TABLE BORDER="1">
<TABLE BORDER="1">
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TH>Field<TH>Summary<TH>Type<TH>DCT<TH>Initial<TH>Access<TH>Modify<TH>Rec Proc Monitor<TH>PP<TR>
<TD>SIOL<TD>Simulation Value Location<TD>INLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>SIOL<TD>Simulation Value Location<TD>INLINK<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SIML<TD>Simulation Mode Location<TD>INLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>SIML<TD>Simulation Mode Location<TD>INLINK<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SIMM<TD>Simulation Mode<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>No<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SIMM<TD>Simulation Mode<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>No<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SIMS<TD>Simulation Mode Alarm Severity<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No
<TD>SIMS<TD>Simulation Mode Alarm Severity<TD>[[RRM 3-14 Menu Choices|GBLCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No

Latest revision as of 22:53, 27 February 2017

EPICS Record Reference Manual


mbbo -- Multi-Bit Binary Output

The normal use for the mbbo record type is to send a binary value (representing one of up to 16 states) to a Digital Output module. It is used for any device that uses more than one contiguous bit to control it. The mbbo record can also be used to write discrete values to other records via database or channel access links.

Parameter Fields

The multi-bit binary output fields fall into the following categories:

  • scan parameters
  • desired output parameters
  • write and convert parameters
  • operator display parameters
  • alarm parameters
  • run-time parameters

Scan Parameters

The mbbo record has the standard fields for specifying under what circumstances it will be processed. These fields are listed in Scan Fields. In addition, Scanning Specification explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.


Desired Output Parameters

The multi-bit binary output record, like all output records, must specify where its output originates. The output mode select (OMSL) field determines whether the output originates from another record or from database access (i.e., the operator). When set to closed_loop, the desired output is retrieved from the link specified in the desired output (DOL) field--which can specify either a database or channel access link--and placed into the VAL field. When set to supervisory, the DOL field is ignored and the current value of VAL is simply written. VAL can be changed via dpPuts at run-time when OMSL is supervisory. The DOL field can also be a constant, in which case the VAL field is initialized to the constant value. If DOL is a constant, OMSL cannot be set to closed_loop.

The VAL field itself usually consists of an index that specifies one of the states. The actual output written is the value of RVAL, which is converted from VAL following the routine explained in the next section. However, records that use the Soft Channel device support module write the VAL field's value without any conversion.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OMSLOutput Mode SelectGBLCHOICEYes0YesYesNoNo
DOLDesired Output Location (an Input Link)INLINKYes0YesYesNoNo
VALValue FieldENUMNo0YesYesYesYes


Convert and Write Parameters

The device support routines write the desired output to the location specified in the OUT field. If the record uses soft device support, OUT can contain a constant, a database link, or a channel access link; however, if OUT is a constant, no value will be written.

For records that write their values to hardware devices, the OUT output link must specify the address of the I/O card, and the DTYP field must specify the corresponding device support module. Be aware that the address format differs according to the I/O bus used. See Address Specification for information on the format of hardware addresses. The user can see a list of the device support modules currently supported at the user's local site by using the dbst utility in R3.13.

For mbbo records that write to hardware, the value written to the output location is the value contained in RVAL, which is converted from VAL, VAL containing an index of one of the 16 states (0-15). RVAL is then set to the corresponding state value, the value in one of the fields ZRVL through FFVL. Then this value is shifted left according to the number in the SHFT field so that the value is in the correct position for the bits being used (the SHFT value is set by device support and is not configurable by the user).

The state value fields ZRVL through FFVL must be configured by the user before run-time. When the state values are not defined, the states defined (SDEF) field is set to FALSE at initialization time by the record routines. When SDEF is FALSE, then the record processing routine does not try to find a match, RVAL is set equal to VAL, the bits are shifted using the number in SHFT, and the value is written thus.

If the OUT output link specifies a database link, channel access link, or constant, then the DTYP field must specify either one of the two soft device support modules--Soft Channel or Raw Soft Channel. Soft Channel writes the value of VAL to the output link, without any conversion, while Raw Soft Channel writes the value from RVAL after it has undergone the above conversion. See Address Specification for information on specifying links.

Note also that when a string is retrieved as the desired output, a record support routine is provided (put_enum_str) that will set check to see if the string matches one of the strings in the ZRST through FFST fields. If a match is found, RVAL is set equal to the corresponding state value of that string.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OUTOutput LinkOUTLINKYes0YesYesNoNo
DTYPDevice TypeDEVCHOICEYes0YesNoNo 
RVALRaw Data ValueULONGNo0YesYesYesYes
SHFTShiftUSHORTYes0YesYesNoNo
SDEFStates Defined?SHORTNo0YesNoNoNo
ZRVLZero ValueULONGYes0YesYesNoYes
ONVLOne valueULONGYes0YesYesNoYes
TWVLTwo ValueULONGYes0YesYesNoYes
THVLThree ValueULONGYes0YesYesNoYes
FRVLFour ValueULONGYes0YesYesNoYes
FVVLFive ValueULONGYes0YesYesNoYes
SXVLSix ValueULONGYes0YesYesNoYes
SVVLSeven ValueULONGYes0YesYesNoYes
EIVLEight valueULONGYes0YesYesNoYes
NIVLNine ValueULONGYes0YesYesNoYes
TEVLTen ValueULONGYes0YesYesNoYes
ELVLEleven ValueULONGYes0YesYesNoYes
TVVLTwelve ValueULONGYes0YesYesNoYes
TTVLThirteen ValueULONGYes0YesYesNoYes
FTVLFourteen ValueULONGYes0YesYesNoYes
FFVLFifteen ValueULONGYes0YesYesNoYes
ZRSTZero StringSTRING [16]YesNullYesYesNoYes
ONSTOne StringSTRING [16]YesNullYesYesNoYes
TWSTTwo StringSTRING [16]YesNullYesYesNoYes
THSTThree StringSTRING [16]YesNullYesYesNoYes
FRSTFour StringSTRING [16]YesNullYesYesNoYes
FVSTFive StringSTRING [16]YesNullYesYesNoYes
SXSTSix StringSTRING [16]YesNullYesYesNoYes
SVSTSeven StringSTRING [16]YesNullYesYesNoYes
EISTEight StringSTRING [16]YesNullYesYesNoYes
NISTNine StringSTRING [16]YesNullYesYesNoYes
TESTTen StringSTRING [16]YesNullYesYesNoYes
ELSTEleven StringSTRING [16]YesNullYesYesNoYes
TVSTTwelve StringSTRING [16]YesNullYesYesNoYes
TTSTThirteen StringSTRING [16]YesNullYesYesNoYes
FTSTFourteen StringSTRING [16]YesNullYesYesNoYes
FFSTFifteen StringSTRING [16]YesNullYesYesNoYes


Operator Display Parameters

These parameters are used to present meaningful data to the operator. These fields are used to display the value and other parameters of the mbbo record either textually or graphically. The ZRST-FFST fields contain strings describing each of the corresponding states. The get_enum_str and get_enum_strs record routines retrieve these strings for the operator. Get_enum_str gets the string corresponding to the value set in VAL, and get_enum_strs retrieves all the strings.

See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
ZRST,...,FFSTZero String, One String, ...STRING [16]YesNullYesYesNoYes
NAMERecord NameSTRING [29]Yes0YesNoNo 
DESCDescriptionSTRING [29]YesNullYesYesNoNo


Alarm Parameters

The possible alarm conditions for multi-bit binary outputs are the SCAN, READ, INVALID, and state alarms. The SCAN and READ alarms are called by the support modules and are not configurable by the user, as their severity is always MAJOR.

The IVOA field specifies an action to take from a number of possible choices when the INVALID alarm is triggered. The IVOV field contains a value to be written once the INVALID alarm has been triggered if Set output to IVOV has been chosen in the IVOA field. The severity of the INVALID alarm is not configurable by the user.

The state alarms are configured in the below severity fields. These fields have the usual possible values for severity fields: NO_ALARM, MINOR, and MAJOR.

The unknown state severity field (UNSV), if set to MINOR or MAJOR, triggers an alarm when the record support routine cannot find a matching value in the state value fields for VAL or when VAL is out of range.

The change of state severity field (COSV) triggers an alarm when the record's state changes, if set to MAJOR or MINOR.

The state severity (ZRSV-FFSV) fields, when set to MAJOR or MINOR, trigger an alarm when VAL equals the corresponding field.

See Alarm Specification for a complete explanation of discrete alarms and these fields. See Invalid Alarm Output Action for an explanation of the IVOA and IVOV fields. Alarm Fields lists other fields related to a alarms that are common to all record types.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
UNSVUnknown State SeverityGBLCHOICEYes0YesYesNoYes
COSVChange of State SeverityGBLCHOICEYes0YesYesNoYes
IVOAInvalid Alarm Output ActionGBLCHOICEYes0YesYesNoNo
IVOVInvalid Alarm Output Value, in eng. unitsDOUBLEYes0YesYesNoNo
ZRSV0 State SeverityGBLCHOICEYes0YesYesNoYes
ONSV1 State SeverityGBLCHOICEYes0YesYesNoYes
TWSV2 State SeverityGBLCHOICEYes0YesYesNoYes
THSV3 State SeverityGBLCHOICEYes0YesYesNoYes
FRSV4 State SeverityGBLCHOICEYes0YesYesNoYes
FVSV5 State SeverityGBLCHOICEYes0YesYesNoYes
SXSV6 State SeverityGBLCHOICEYes0YesYesNoYes
SVSV7 State SeverityGBLCHOICEYes0YesYesNoYes
EISV8 State SeverityGBLCHOICEYes0YesYesNoYes
NISV9 State SeverityGBLCHOICEYes0YesYesNoYes
TESV10 State SeverityGBLCHOICEYes0YesYesNoYes
ELSV11 State SeverityGBLCHOICEYes0YesYesNoYes
TVSV12 State SeverityGBLCHOICEYes0YesYesNoYes
TTSV13 State SeverityGBLCHOICEYes0YesYesNoYes
FTSV14 State SeverityGBLCHOICEYes0YesYesNoYes
FFSV15 State SeverityGBLCHOICEYes0YesYesNoYes

Run-Time and Simulation Mode Parameters

These parameters are used by the run-time code for processing the multi-bit binary output.

MASK is used by device support routine to read the hardware register. Record support sets low order of MASK the number of bits specified in NOBT. Device support can shift this value.

The LALM field implements the change of state alarm severity by holding the value of VAL when the previous change of state alarm was issued.

MLST holds the value when the last monitor for value change was triggered.

SDEF is used by record support to save time if no states are defined; it is used for converting VAL to RVAL.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
NOBTNumber of BitsSHORTYes0YesNoNo 
ORAWOld Raw DataULONGNo0YesNoNoNo
MASKMaskULONGNo0YesNoNoNo
LALMLast AlarmedUSHORTNo0YesNoNoNo
MLSTMonitor LastUSHORTNo0YesNoNoNo
SDEFStates Defined?SHORTNo0YesNoNoNo

The following fields are used to operate the mbbo record in the simulation mode. See Fields Common to Many Record Types for more information on the simulation mode fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
SIOLSimulation Value LocationINLINKYes0YesYesNoNo
SIMLSimulation Mode LocationINLINKYes0YesYesNoNo
SIMMSimulation ModeGBLCHOICENo0YesYesNoNo
SIMSSimulation Mode Alarm SeverityGBLCHOICEYes0YesYesNoNo

Record Support

Record Support Routines

init_record

This routine initializes SIMM if SIML is a constant or creates a channel access link if SIML is PV_LINK. If SIOL is PV_LINK a channel access link is created.

This routine next checks to see that device support is available. The routine next checks to see if the device support write routine is defined. If either device support or the device support write routine does not exist, an error message is issued and processing is terminated.

If DOL is a constant, then VAL is initialized to its value and UDF is set to FALSE.

MASK is cleared and then the NOBT low order bits are set.

If device support includes init_record, it is called.

init_common is then called to determine if any states are defined. If states are defined, SDEF is set to TRUE.

If device support returns success, VAL is then set from RVAL and UDF is set to FALSE.

process

See next section.

special

Computes SDEF when any of the fields ZRVL,...FFVL change value.

get_value

Fills in the values of struct valueDes so that they refer to VAL.

get_enum_str

Retrieves ASCII string corresponding to VAL.

get_enum_strs

Retrieves ASCII strings for ZRST,...FFST.

put_enum_str

Checks if string matches ZRST,...FFST and if it does, sets VAL.


Record Processing

Routine process implements the following algorithm:


  1. Check to see that the appropriate device support module exists. If it doesn't, an error message is issued and processing is terminated with the PACT field still set to TRUE. This ensures that processes will not longer be called for this record. Thus error storms will not occur.
  2. If PACT is FALSE
    • If DOL is DB_LINK and OMSL is CLOSED_LOOP
      • Get value from DOL
      • Set UDF to FALSE
      • Check for link alarm
    • If any state values are defined
      • If VAL > 15, then raise alarm and go to 4
      • Else using VAL as index set RVAL = one of ZRVL,...FFVL
    • Else set RVAL = VAL
    • Shift RVAL left SHFT bits
  3. Convert
    • If PACT is FALSE, compute RVAL
      • If VAL is 0,...,15, set RVAL from ZRVL,...,FFVL
      • If VAL out of range, set RVAL = undefined
    • Status = write_mbbo
  4. Check alarms. This routine checks to see if the new VAL causes the alarm status and severity to change. If so, NSEV, NSTA and LALM are set.
  5. Check severity and write the new value. See Simulation Mode and Invalid Alarm Output Action for more information.
  6. If PACT has been changed to TRUE, the device support write output routine has started but has not completed writing the new value. In this case, the processing routine merely returns, leaving PACT TRUE.
  7. Check to see if monitors should be invoked.
    • Alarm monitors are invoked if the alarm status or severity has changed.
    • Archive and value change monitors are invoked if MLST is not equal to VAL.
    • Monitors for RVAL and RBV are checked whenever other monitors are invoked.
    • NSEV and NSTA are reset to 0.
  8. Scan forward link if necessary, set PACT FALSE, and return.


Device Support

Fields Of Interest To Device Support

Each mbbo record must have an associated set of device support routines. The primary responsibility of the device support routines is to obtain a new raw mbbo value whenever write_mbbo is called. The device support routines are primarily interested in the following fields:


NameSummaryDescription
PACTProcessing ActiveSee Fields Common to All Record Types for an explanation of these fields.
DPVTDevice Private
NSEVNew Alarm Severity
NSTANew Alarm Status
NOBTNumber of BitsNumber of hardware bits accessed. They must be consecutive.
OUTOutput LinkThis field is used by the device support routines to locate its output.
RVALRaw data value.This is the value to be written to OUT.
RBVRead Back ValueIt is the responsibility of the device support modules to set this field.
MASKMaskThis is a mask used to read the hardware. Record support sets the low order NOBT bits. The device support routine can shift the bits. The device support routine should perform the shift in init_record.
SHFTShiftThis can be set by the device support module at init_record time.


Device Support Routines

Device support consists of the following routines:

report

report(FILE fp, paddr)

Not currently used.

init

init()

This routine is called once during IOC initialization.

init_record

init_record(precord)

This routine is optional. If provided, it is called by the record support init_record routine. If MASK is used, it should be shifted if necessary and SHFT given a value.

get_ioint_info

get_ioint_info(int cmd,struct dbCommon *precord,IOSCANPVT *ppvt)

This routine is called by the ioEventScan system each time the record is added or deleted from an I/O event scan list. cmd has the value (0,1) if the record is being (added to, deleted from) an I/O event list. It must be provided for any device type that can use the ioEvent scanner.

write_mbbo

write_mbbo(precord)

This routine must output a new value. It returns the following values:

  • 0: Success.
  • Other: Error.


Device Support For Soft Records

Soft Channel

The Soft Channel module writes the current value of VAL.

If the OUT link type is PV_LINK, then dbCaAddInlink is called by init_record.

write_mbbo calls recGblPutLinkValue to write the current value of VAL. See Soft Output for more information.

Raw Soft Channel

This module writes RVAL to the location specified in the output link. It returns a 0.




EPICS Record Reference Manual - 19 MAY 1998