Difference between revisions of "RRM 3-14 Pulse Counter"

From EPICSWIKI
 
 
Line 19: Line 19:
=== Scan Parameters ===
=== Scan Parameters ===


The pulse counter record has the standard fields for specifying under what circumstances it will be processed. These fields are listed in [[RRM 3-13 dbCommon#Scan Fields|Scan Fields]]. In addition, [[RRM 3-13 Concepts#Scanning Specification|Scanning Specification]] explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.
The pulse counter record has the standard fields for specifying under what circumstances it will be processed. These fields are listed in [[RRM 3-14 dbCommon#Scan Fields|Scan Fields]]. In addition, [[RRM 3-14 Concepts#Scanning Specification|Scanning Specification]] explains how these fields are used. Note that I/O event scanning is only supported for those card types that interrupt.




Line 26: Line 26:
These parameters control the characteristics of the counter pulse. Normally, the user only needs to configure the gate type (GTYP) field. This field has two choices, <CODE>Hardware</CODE> or <CODE>Software</CODE>. If hardware is chosen, then the HGV field controls gating. The device support routine should set the HGV field.
These parameters control the characteristics of the counter pulse. Normally, the user only needs to configure the gate type (GTYP) field. This field has two choices, <CODE>Hardware</CODE> or <CODE>Software</CODE>. If hardware is chosen, then the HGV field controls gating. The device support routine should set the HGV field.


If GTYP is configured as software, then gating control is determined by the soft gate location (SGL) and soft gate value (SGV) fields. SGL must be a database link; SGV is read from that link. SGV can have two possible values, <CODE>Active</CODE> or <CODE>Inactive</CODE>. <CODE>Active</CODE> causes the command routine (see below section on run-time parameters) to start counting, while <CODE>Inactive</CODE> causes it to stop counting. See [[RRM 3-13 Concepts#Address Specification|Address Specification]] for information on how to specify database links.
If GTYP is configured as software, then gating control is determined by the soft gate location (SGL) and soft gate value (SGV) fields. SGL must be a database link; SGV is read from that link. SGV can have two possible values, <CODE>Active</CODE> or <CODE>Inactive</CODE>. <CODE>Active</CODE> causes the command routine (see below section on run-time parameters) to start counting, while <CODE>Inactive</CODE> causes it to stop counting. See [[RRM 3-14 Concepts#Address Specification|Address Specification]] for information on how to specify database links.


The device support routines should also set the counter size (CSIZ), counter edge (CNTE), and count source (CNTS) fields. Nevertheless, these fields can be configured using a configuration tool. CSIZ can be 16 bit or 32 bit. With 32 bit, two counters are used. The CNTE field determines whether counting occurs on the rising or falling edge of the source signal. It's choices are <CODE>Rising Edge</CODE> or <CODE>Falling Edge</CODE>. The CNTS determines the count source during setup.
The device support routines should also set the counter size (CSIZ), counter edge (CNTE), and count source (CNTS) fields. Nevertheless, these fields can be configured using a configuration tool. CSIZ can be 16 bit or 32 bit. With 32 bit, two counters are used. The CNTE field determines whether counting occurs on the rising or falling edge of the source signal. It's choices are <CODE>Rising Edge</CODE> or <CODE>Falling Edge</CODE>. The CNTS determines the count source during setup.
Line 35: Line 35:
<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>GTYP<TD>Gate Type <TD>[[RRM 3-13 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>GTYP<TD>Gate Type <TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SGL <TD>Soft Gate Location (Input Link) <TD>INLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>SGL <TD>Soft Gate Location (Input Link) <TD>INLINK<TD>Yes<TD>0<TD>No<TD>No<TD>N/A<TD>No<TR>
<TD>SGV<TD>Soft Gate Value <TD>[[RRM 3-13 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>SGV<TD>Soft Gate Value <TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>HGV<TD>Hardware Gate Value<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>HGV<TD>Hardware Gate Value<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>CSIZ<TD>Counter Size<TD>[[RRM 3-13 Menu Choices|RECCHOICE]] <TD>Yes<TD>1<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>CSIZ<TD>Counter Size<TD>[[RRM 3-14 Menu Choices|RECCHOICE]] <TD>Yes<TD>1<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>CNTE <TD> Count Edge<TD>[[RRM 3-13 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>CNTE <TD> Count Edge<TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No<TR>
<TD>CNTS <TD> Count Source<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No
<TD>CNTS <TD> Count Source<TD>SHORT<TD>Yes<TD>0<TD>Yes<TD>Yes<TD>No<TD>No
</TABLE>
</TABLE>
Line 47: Line 47:
=== Write Parameters ===
=== Write Parameters ===


The output link (OUT) specifies where the pulse counter write its output, i.e., the current, recorded value of the counter (VAL). If the record writes its a value to a device, the OUT output link must specify the address of the I/O card, and the DTYP field must contain the name of the appropriate device support module. Be aware that the address format differs according to the I/O bus used. See [[RRM 3-13 Concepts#Address Specification|Address Specification]] for information on the format of hardware addresses. You 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.
The output link (OUT) specifies where the pulse counter write its output, i.e., the current, recorded value of the counter (VAL). If the record writes its a value to a device, the OUT output link must specify the address of the I/O card, and the DTYP field must contain the name of the appropriate device support module. Be aware that the address format differs according to the I/O bus used. See [[RRM 3-14 Concepts#Address Specification|Address Specification]] for information on the format of hardware addresses. You 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.


If the record uses soft device support, then it can be a database or channel access link, or a constant. If it's a constant, no output can be written.  
If the record uses soft device support, then it can be a database or channel access link, or a constant. If it's a constant, no output can be written.  
Line 61: Line 61:
=== Operator Display Parameters ===
=== Operator Display Parameters ===


These parameters are used to present meaningful data to the operator. The display the value and other parameters of the pulse counter either textually or graphically. The operating range fields (HOPR and LOPR) for the pulse counter record apply only to the VAL field. They are retrieved when the <CODE>get_graphic_double</CODE> and <CODE>get_control_double</CODE> record support routines are called. See [[RRM 3-13 dbCommon#Fields Common to All Record Types|Fields Common to All Record Types]] for more on the record name (NAME) and description (DESC) fields.
These parameters are used to present meaningful data to the operator. The display the value and other parameters of the pulse counter either textually or graphically. The operating range fields (HOPR and LOPR) for the pulse counter record apply only to the VAL field. They are retrieved when the <CODE>get_graphic_double</CODE> and <CODE>get_control_double</CODE> record support routines are called. See [[RRM 3-14 dbCommon#Fields Common to All Record Types|Fields Common to All Record Types]] for more on the record name (NAME) and description (DESC) fields.




Line 75: Line 75:
=== Alarm Parameters ===
=== Alarm Parameters ===


The pulse counter record has the alarm parameters common to all record types.  [[RRM 3-13 dbCommon#Alarm Fields|Alarm Fields]] lists other fields related to a alarms that are common to all record types.
The pulse counter record has the alarm parameters common to all record types.  [[RRM 3-14 dbCommon#Alarm Fields|Alarm Fields]] lists other fields related to a alarms that are common to all record types.




Line 105: Line 105:
<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>CMD <TD>Command <TD>[[RRM 3-13 Menu Choices|RECCHOICE]]<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes<TR>
<TD>CMD <TD>Command <TD>[[RRM 3-14 Menu Choices|RECCHOICE]]<TD>No<TD>0<TD>Yes<TD>Yes<TD>Yes<TD>Yes<TR>
<TD>SCMD<TD>Save Command<TD>USHORT<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>SCMD<TD>Save Command<TD>USHORT<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>CPTR <TD>Callback  <TD>ULONG<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>
<TD>CPTR <TD>Callback  <TD>ULONG<TD>No<TD>0<TD>Yes<TD>No<TD>No<TD>No<TR>

Latest revision as of 19:40, 18 April 2008

EPICS Record Reference Manual


pulseCounter

The normal use for the pulseCounter record type is to record counts and write them to a device.

Parameter Fields

The fields fall into the following categories:

  • scan parameters
  • setup parameters
  • write parameters
  • operator display parameters
  • run-time parameters

Scan Parameters

The pulse counter 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.


Setup Parameters

These parameters control the characteristics of the counter pulse. Normally, the user only needs to configure the gate type (GTYP) field. This field has two choices, Hardware or Software. If hardware is chosen, then the HGV field controls gating. The device support routine should set the HGV field.

If GTYP is configured as software, then gating control is determined by the soft gate location (SGL) and soft gate value (SGV) fields. SGL must be a database link; SGV is read from that link. SGV can have two possible values, Active or Inactive. Active causes the command routine (see below section on run-time parameters) to start counting, while Inactive causes it to stop counting. See Address Specification for information on how to specify database links.

The device support routines should also set the counter size (CSIZ), counter edge (CNTE), and count source (CNTS) fields. Nevertheless, these fields can be configured using a configuration tool. CSIZ can be 16 bit or 32 bit. With 32 bit, two counters are used. The CNTE field determines whether counting occurs on the rising or falling edge of the source signal. It's choices are Rising Edge or Falling Edge. The CNTS determines the count source during setup.

Once again, most of these fields are set by the device support routines.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
GTYPGate Type RECCHOICEYes0YesYesNoNo
SGL Soft Gate Location (Input Link) INLINKYes0NoNoN/ANo
SGVSoft Gate Value RECCHOICEYes0YesYesNoNo
HGVHardware Gate ValueSHORTYes0YesYesNoNo
CSIZCounter SizeRECCHOICE Yes1YesYesNoNo
CNTE Count EdgeRECCHOICEYes0YesYesNoNo
CNTS Count SourceSHORTYes0YesYesNoNo


Write Parameters

The output link (OUT) specifies where the pulse counter write its output, i.e., the current, recorded value of the counter (VAL). If the record writes its a value to a device, the OUT output link must specify the address of the I/O card, and the DTYP field must contain the name of the appropriate 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. You 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.

If the record uses soft device support, then it can be a database or channel access link, or a constant. If it's a constant, no output can be written.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
OUTOutput Link OUTLINKYes0NoNoN/ANo
DTYPDevice TypeDEVCHOICEYes0YesNoNoNo


Operator Display Parameters

These parameters are used to present meaningful data to the operator. The display the value and other parameters of the pulse counter either textually or graphically. The operating range fields (HOPR and LOPR) for the pulse counter record apply only to the VAL field. They are retrieved when the get_graphic_double and get_control_double record support routines are called. See Fields Common to All Record Types for more on the record name (NAME) and description (DESC) fields.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
HOPR High Operating RangeFLOATYes4.3e+9YesYesNoNo
LOPR Low Operating Range FLOATYes0YesYesNoNo
NAMERecord NameSTRING [29]Yes0YesNoNoNo
DESCDescriptionSTRING [29]YesNullYesYesNoNo


Alarm Parameters

The pulse counter record has the alarm parameters common to all record types. Alarm Fields lists other fields related to a alarms that are common to all record types.


Run-time parameters

These parameters are used by the record itself and the device support routines. They are not configurable prior to run-time, and only the CMD and VAL fields are modifiable by a user at run-time.

The CMD field controls the command routines that control the counter. It has five commands:


Read
Read the current value of the counter
Clear
Stop and clear the counter, i.e., reset it to zero. Since the Stop command is also invoked, the Start command must be issued to start the counter after this command is invoked.
Start
Start counting
Stop
Stop counting. This does not reset the counter.
Setup
Do not begin counting until Start command is issued.

The VAL field holds the current number of recorded pulses. It is normally set by the read command.

The record support routines and device support routines sometimes use the SCMD field to temporarily store the currently active CMD, after which they change the current, active command in the CMD field. When they are done, they will set the command back to the saved command.

The OSGV field is used to implement monitors for the SGV field.


FieldSummaryTypeDCTInitialAccessModifyRec Proc MonitorPP
CMD Command RECCHOICENo0YesYesYesYes
SCMDSave CommandUSHORTNo0YesNoNoNo
CPTR Callback ULONGNo0YesNoNoNo
VALCounter Value ULONGNo0YesYesYesNo
OSGV Old Soft Gate Value SHORTNo0YesNoNoNo


Record Support

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.


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.
    • Alarm monitors are invoked if the alarm status or severity has changed.
    • Archive and value change monitors on CMD are invoked if values have changed.
    • NSEV and NSTA are reset to 0.
  6. Scan forward link if necessary, set PACT FALSE, and return.


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:


NameSummaryDescription
CSIZ Counter sizeThis 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,IGVGate 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:

  • 0: Success.
  • Other: Error.




EPICS Record Reference Manual - 19 MAY 1998