Table of Contents Previous Chapter Chapter 26: pulseCounter

Chapter 26: pulseCounter

1. Introduction

The normal use for the pulseCounter record type is to record counts.

2. Field Summary

--------------------------------------------------------------
Field  Type       DCT  Initial  Access  Modify  Rec Proc   PP   
                                                Monitor         
--------------------------------------------------------------
VAL    ULONG      No   0        Yes     Yes     Yes        No   
OUT    OUTLINK    Yes  0        No      No      N/A        No   
GTYP   RECCHOICE  Yes  0        Yes     Yes     No         No   
HGV    SHORT      Yes  0        Yes     Yes     No         No   
SGL    INLINK     Yes  0        No      No      N/A        No   
SGV    RECCHOICE  Yes  0        Yes     Yes     No         No   
OSGV   SHORT      No   0        Yes     No                 No   
CSIZ   RECCHOICE  Yes  1        Yes     Yes                No   
CNTE   RECCHOICE  Yes  0        Yes     Yes     No         No   
CNTS   SHORT      Yes  0        Yes     Yes     No         No   
HOPR   FLOAT      Yes  4.3e+9   Yes     Yes     No         No   
LOPR   FLOAT      Yes  0        Yes     Yes     No         No   
CMD    RECCHOICE  No   0        Yes     Yes     Yes        Yes  
SCMD   USHORT     No   0        Yes     No                 No   
CPTR   ULONG      No   0        Yes     No                 No   
--------------------------------------------------------------

3. Field Descriptions

---------------------------------------------------------------------------------------
Name  Summary              Description                                                   
---------------------------------------------------------------------------------------
VAL   Counter Value        The read command places the current value of the counter      
                           into the VAL field.                                           
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.                  
GTYP  Gate Type            This can be Hardware or software.  If GTYP is hardware,       
                           then HGV determines gating control.  If GTYP is software,     
                           the SGV determines gating control.                            
HGV   Hardware Gate        If GTYP is hardware, then this field is device dependent.     
      Value                                                                              
SGL   Soft Gate Location   If SGL is a database link and GTYP is software, then SGV      
      (Input Link)         will be set to the value read from SGL.                       
SGV   Soft Gate Value      This can be inactive or active.  This will enable and         
                           disable counting if GTYP is software.                         
OSGV  Old Soft Gate Value  This is the previous value of SGV.                            
CSIZ  Counter size         16 bit or 32 bit counter.                                     
CNTE  Count Edge           This can be Rising Edge or Falling Edge.  This field forces   
                           counting on rising or falling edge of source signal.          
CNTS  Count Source                                                                       
HOPR  High Operating       These fields determine the upper and lower display limits     
      Range                for graphics displays and the upper and lower control         
                           limits for control displays. The fields are used by record    
                           support routines to honor calls to                            
                           get_graphic_double or get_control_double.                     
LOPR  Low Operating                                                                      
      Range                                                                              
CMD   Command              Read:  Read the current value of the counter.                 
                           Clear:  Clear the counter.  Note theat the counter is also    
                           stopped. The Start command must be issued to restart the      
                           counter.                                                      
                           Start:  Start counting.                                       
                           Stop:  Stop counting.                                         
                           Setup:  Setup the counter.  Counting will not begin until     
                           the Start command is issued.                                  
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
SCMD  Save Command         This is the saved value of CMD.                               
CPTR  Callback                                                                           
---------------------------------------------------------------------------------------

4. Record Support Routines

init_record

This routine next checks to see that device support is available. If it does not exist, an error message is issued and processing is terminated.

If SGL is a constant and GTYP is software, then SGV is initialized with its value. If SGL type is PV_LINK a channel access link is created.

Device support is then checked to see if cmd_pc is defined.

If device support includes init_record, it is called.

process

See next section.

get_value

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

get_graphic_double

Sets the upper display and lower display limits for a field. If the field is VAL the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.

get_control_double

Sets the upper control and the lower control limits for a field. If the field is VAL the limits are set to HOPR and LOPR, else if the field has upper and lower limits defined they will be used, else the upper and lower maximum values for the field type will be used.

5. Record Processing

The 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 SGL is DB_LINK and GTYP is Software, get SGV from SGL. If SGV has changed, save the CMD value, call the command routine with START if SGV =0 or with STOP if SGV is 1, reset the command to the saved value, and set alarms if return status not zero. If the device is not done (PACT TRUE), then issue a callback request for this record to process and return
  3. If CMD is not READ, call command routine and set CMD to READ. If the device is not done (PACT TRUE), then issue a callback request for this record to process again and return.
  4. Call command routine. If device support set PACT to TRUE, then return.
  5. Check to see if monitors should be invoked.
  6. Scan forward link if necessary, set PACT FALSE, and return.

6. Device Support

Fields Of Interest To Device Support

Each record must have an associated set of device support routines. The primary responsibility of the device support routines is to issue commands to the output device. The device support routines are primarily interested in the following fields:

-------------------------------------------------------------------------------------
Name      Summary       Description                                                    
-------------------------------------------------------------------------------------
CSIZ      Counter size  This will determine to a 16 bit or 32 bit count is to be       
                        used.  With 32 bit, two counters are used.                     
CMD       Command       The device support routine is responsible for processing       
                        the commands READ, CLEAR, START, STOP, and SETUP.              
GTYP,IGV  Gate Type     If GTYP is internal, device support is responsible for using   
                        IGV to determine gating control.                               
CNTE      Count Edge    This field is used by the device support routines to force     
                        counting on leading or falling edge of signal.                 
CNTS      Count Source  Device support must use CNTS to set count source during        
                        setup.                                                         
-------------------------------------------------------------------------------------

Device Support Routines

Device support consists of the following routines:

report

  report()
This routine is optional. If provided, it prints a report of all device modules.

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.

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.

cmd_pc

  cmd_pc(precord)
This routine issues commands to the output device. It returns the following values:

 
Table of Contents Next Chapter