Table of Contents Previous Chapter Chapter 21: mbbo - MultiBit Binary Output

Chapter 21: mbbo - MultiBit Binary Output

1. Introduction

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 can also be used to write to other records via database or channel access links.

2. Field Summary

--------------------------------------------------------------
Field  Type       DCT  Initial  Access  Modify  Rec Proc   PP   
                                                Monitor         
--------------------------------------------------------------
VAL    ENUM       No   0        Yes     Yes     Yes        Yes  
DOL    INLINK     Yes  0        No      No      N/A        No   
OMSL   GBLCHOICE  Yes  0        Yes     Yes     No         No   
NOBT   SHORT      Yes  0        Yes     No                 No   
OUT    OUTLINK    Yes  0        No      No      N/A        No   
ZRVL   ULONG      Yes  0        Yes     Yes     No         Yes  
ONVL   ULONG      Yes  0        Yes     Yes     No         Yes  
TWVL   ULONG      Yes  0        Yes     Yes     No         Yes  
THVL   ULONG      Yes  0        Yes     Yes     No         Yes  
FRVL   ULONG      Yes  0        Yes     Yes     No         Yes  
FVVL   ULONG      Yes  0        Yes     Yes     No         Yes  
SXVL   ULONG      Yes  0        Yes     Yes     No         Yes  
SVVL   ULONG      Yes  0        Yes     Yes     No         Yes  
EIVL   ULONG      Yes  0        Yes     Yes     No         Yes  
NIVL   ULONG      Yes  0        Yes     Yes     No         Yes  
TEVL   ULONG      Yes  0        Yes     Yes     No         Yes  
ELVL   ULONG      Yes  0        Yes     Yes     No         Yes  
TVVL   ULONG      Yes  0        Yes     Yes     No         Yes  
TTVL   ULONG      Yes  0        Yes     Yes     No         Yes  
FTVL   ULONG      Yes  0        Yes     Yes     No         Yes  
FFVL   ULONG      Yes  0        Yes     Yes     No         Yes  
ZRST   STRING     Yes  Null     Yes     Yes     No         Yes  
ONST   STRING     Yes  Null     Yes     Yes     No         Yes  
TWST   STRING     Yes  Null     Yes     Yes     No         Yes  
THST   STRING     Yes  Null     Yes     Yes     No         Yes  
FRST   STRING     Yes  Null     Yes     Yes     No         Yes  
FVST   STRING     Yes  Null     Yes     Yes     No         Yes  
SXST   STRING     Yes  Null     Yes     Yes     No         Yes  
SVST   STRING     Yes  Null     Yes     Yes     No         Yes  
EIST   STRING     Yes  Null     Yes     Yes     No         Yes  
NIST   STRING     Yes  Null     Yes     Yes     No         Yes  
TEST   STRING     Yes  Null     Yes     Yes     No         Yes  
ELST   STRING     Yes  Null     Yes     Yes     No         Yes  
TVST   STRING     Yes  Null     Yes     Yes     No         Yes  
TTST   STRING     Yes  Null     Yes     Yes     No         Yes  
FTST   STRING     Yes  Null     Yes     Yes     No         Yes  
FFST   STRING     Yes  Null     Yes     Yes     No         Yes  
ZRSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
ONSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
TWSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
THSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
FRSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
FVSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
SXSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
SVSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
EISV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
NISV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
TESV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
ELSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
TVSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
TTSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
FTSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
FFSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
UNSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
COSV   GBLCHOICE  Yes  0        Yes     Yes     No         Yes  
RVAL   ULONG      No   0        Yes     Yes     Yes        Yes  
ORAW   ULONG      No   0        Yes     No      No         No   
RBV    ULONG      No   0        Yes     No      Yes        No   
ORBV   ULONG      No   0        Yes     No      No         No   
MASK   ULONG      No   0        Yes     No      No         No   
MLST   USHORT     No   0        Yes     No      No         No   
LALM   USHORT     No   0        Yes     No      No         No   
SDEF   SHORT      No   0        Yes     No      No         No   
SHFT   USHORT     No   0        Yes     No      No         No   
SIOL   OUTLINK    Yes  0        No      No      N/A        No   
SIML   INLINK     Yes  0        No      No      N/A        No   
SIMM   GBLCHOICE  No   0        Yes     Yes     No         No   
SIMS   GBLCHOICE  Yes  0        Yes     Yes     No         No   
IVOA   GBLCHOICE  Yes  0        Yes     Yes     No         No   
IVOV   USHORT     Yes  0        Yes     Yes     No         No   
--------------------------------------------------------------

3. Field Descriptions

----------------------------------------------------------------------------------------------------
Name             Summary              Description                                                     
----------------------------------------------------------------------------------------------------
VAL              Value Field          This is the index of the state value to be sent to OUT.         
DOL              Desired Output       If DOL is a database or channel access link and OMSL is         
                 Location (an Input   CLOSED_LOOP, then VAL is read from DOL.                         
                 Link)                                                                                
OMSL             Output Mode Select   This field has either the value SUPERVISORY or                  
                                      CLOSED_LOOP.  DOL is used to determine VAL only if              
                                      OMSL has the value CLOSED_LOOP.  By setting this field,         
                                      the record can be switched between supervisory and              
                                      closed loop mode of operation. While in closed loop             
                                      mode, the VAL field cannot be set via dbPuts.                   
NOBT             Number of Bits       Number of bits in hardware mask.                                
OUT              Output Link          This field is used by the device support routines to decide     
                                      where to send output. For soft records, it can be a             
                                      constant, a database link, or a channel access link.  If the    
                                      link is a constant, the result is no output.                    
ZRVL,...,FFVL    Zero Value, One      Masks for hardware value associated with each state.            
                 Value, ...                                                                           
ZRST,...,FFST    Zero State, One      Strings associated with each state.                             
                 State, ...                                                                           
ZRSV,...,FFSV    Zero Severity, One   Alarm severity associated with each state.                      
                 Severity, ...                                                                        
UNSV             Unknown State                                                                        
                 Severity                                                                             
COSV             Change of State                                                                      
                 Severity                                                                             
RVAL             Raw Data Value       RVAL is the value to be written to the hardware device. It      
                                      is determined by the record support module using VAL as         
                                      the index of the values stored in ZRVL,...FFVL. The value       
                                      is also shifted left SHFT bits.                                 
ORAW             Old Raw Data         ORAW is used to decide if monitors should be triggered for      
                 Value                RVAL at the same time monitors are generated for changes        
                                      in VAL.                                                         
RBV              Read Back Value      This is the actual read back value obtained from the            
                                      hardware itself or from the associated device driver.  It is    
                                      the responsibility of the device support routine to give this   
                                      field a value.                                                  
ORAW             Old Read Back        ORBV is used to decide if monitors should be triggered for      
                 Value                RBV at the same time monitors are triggered for changes         
                                      in VAL.                                                         
MASK             Mask                 Mask used by device support routine to read hardware            
                                      register. Record support sets low order NOBT bits. Device       
                                      support can shift this value.                                   
MLST             Monitor Last         Value when last monitor for value changes was triggered.        
LALM             Last Alarmed         Value when last change of state alarm was issued.               
SDEF             States Defined?      Record support uses this field to save time if no states are    
                                      defined.                                                        
SHFT             Shift                Number of bits to shift values obtained from                    
                                      ZRVL,...,FFVL.                                                  
SIMM             Simulation Mode      Simulation mode process variables.  Refer to Chapter 3,         
                                      Section "Simulation Mode" on page 13 for more                   
                                      information.                                                    
SIML             Simulation Mode                                                                      
                 Location                                                                             
SIOL             Simulation Value                                                                     
                 Location                                                                             
SIMS             Simulation Mode                                                                      
                 Alarm Severity                                                                       
IVOA             Invalid Alarm        Whenever the record is put into INVALID alarm severity          
                 Output Action        IVOA specifies an action.  See Chapter 3, Section "Invalid      
                                      Alarm Output Action" on page 14 for more information            
IVOV             Invalid Alarm                                                                        
                 Output Value                                                                         
----------------------------------------------------------------------------------------------------

4. 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.

5. 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 no longer be called for this record. Thus error storms will not occur.
  2. If PACT is FALSE
  3. Convert
  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 Chapter 3, Section "Simulation Mode" on page 13 and Chapter 3, Section "Invalid Alarm Output Action" on page 14 for details.
  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.
  8. Scan forward link if necessary, set PACT FALSE, and return.

6. 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:

--------------------------------------------------------------------------------------
Name  Summary             Description                                                   
--------------------------------------------------------------------------------------
PACT  Processing Active   See Chapter 2, Section "Database Common: Field                
                          Descriptions" on page 4 for descriptions.                     
DPVT  Device Private                                                                    
NSEV  New Alarm Severity                                                                
NSTA  New Alarm Status                                                                  
NOBT  Number of Bits      Number of hardware bits accessed. They must be                
                          consecutive.                                                  
OUT   Output Link         This field is used by the device support routines to locate   
                          its output.                                                   
RVAL  Raw data value.     This is the value to be written to OUT.                       
RBV   Read Back Value      It is the responsibility of the device support modules to    
                          set this field.                                               
MASK  Mask                This 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 in init_record.                          
SHFT  Shift               This 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:

7. Device Support For Soft Records

This 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 Chapter 3, Section "Soft Output" on page 13 for details.

 
Table of Contents Next Chapter