Guide to Using Records with CAMAC

P. Sichta (PPPL)

Rev. 0 17JUN99

Rev. 1 13JAN00

 

Introduction

--------------

This document provides insight about using records with the device type (DTYP) selected to 'Camac'. Note there is a separate Generic CAMAC record, see reference 1.

Also, there is a section to describe how to get a IOC report of all PV that are connected to CAMAC.

 

References

-----------

  1. EPICS Generic CAMAC Record Document, hyperlink : http://cars.uchicago.edu/software/recCamac.html
  2. Comments in source code (LANL/Eric Bjorklund)

 

Record Definition for a Record with DTYP=Camac

-------------------------------------------------------

* Generic CAMAC device support for EPICS. Record types supported are:

* o Analog input and output (ai, ao)

* o Binary input and output (bi, bo)

* o Longword input and output (longin, longout)

* o Multi-bit binary input and output (mbbi, mbbo)

For each of these record types the DTYP field must be set to Camac. When Camac is selected, the INP field shows "#B0 C0 N0 A0 F0 @". Use the following guidelines, all values are entered in decimal :

/*

*********** start of @ parameter definitions ****************************

*

*

*

* MODULE DESCRIPTION:

*

* Generic CAMAC device support for EPICS. Record types supported are:

* o Analog input and output (ai, ao)

* o Binary input and output (bi, bo)

* o Longword input and output (longin, longout)

* o Multi-bit binary input and output (mbbi, mbbo)

* o Waveform (wf)

*

* The generic CAMAC device support routines can be used for cards that

* only require a single BCNAF sequence to read or command (but see allowances

* for bo and mbbo records below) and that do not require LAMs or any special

* conversion.

*

* The routines in this module are all globally accessible so that they may

* be invoked if desired by device-support routines for more specialized

* CAMAC cards. See the header file, devCamac.h, for further information.

*

*----------------------------------------------------------------------------

* RECORD FIELDS OF INTEREST:

*

* The following fields should be set during database configuration:

* DTYP = Camac

* INP/OUT = B -> Branch number of card

* C -> Crate number of card

* N -> Slot number of card

* A -> Subaddress to access

* F -> CAMAC Function code

* PARM -> Other information, e.g. range values, bit number,

* readback function code, etc.

*

* The contents and format of the PARM field depend on the record type as

* follows:

*

*---------------------

* Analog and Longword Input (AI, LI) --

*

* F = Function code to read raw value

*

*

* PARM = Expected range of input value.

* For unipolar devices, the PARM field is a single number representing

* how many bits of precision are contained in the incomming word. This

* number may be in either decimal or hexidecimal notation. For example,

* the PARM field for a 12-bit unipolar card may be specified as either

* "4095" or "0xfff". A 16-bit value may be either "0xffff" or "65535".

*

* For bipolar devices, the PARM field has two values representing the

* positive and negative limits of the input value. Alternatively, one

* of the PARM values may be the word "Bipolar", indicating that the

* second range parameter is the negative of the first. Twos-compliment

* format is assumed for bipolar devices.

*

* The PARM values may be separated by a commas, colons, semi-colons, or

* white space. Values may be specified in any order. The following

* examples are all valid ways to specify a 12-bit bipolar input:

* -2048,2047

* 0x7ff -0x7ff

* 2047:bipolar

* Bipolar,-2048

*

*---------------------

* Analog and Longword Output (AO, LO) --

*

* F = Function code to write raw value

*

* PARM = Expected range of output value, plus (optional) readback function

* code. The range parameters are the same as for analog or longword

* input records. If the card has a readback function code (and the

* readback uses the same subaddress as the write), it should be specified

* in the PARM field as "Rn", where "n" is the readback function code.

*

* Specifying a readback function code will enable the device-support

* software to read the current state of the hardware at record

* initialization time and store it in the RVAL field (VAL field for

* longword records). This aids in performing "bumpless" reboots of the

* IOC. In addition, for AO records, the readback is issued after every

* write and stored in the RBV field.

*

* Following are examples of valid PARM fields for AO and LO records:

* 0xffffff:R0 (24-bit, unipolar, readback is F0)

* R1:Bipolar:2047 (12-bit, bipolar, readback is F1)

* 0xffff bipolar (16-bit, unipolar, no readback)

*

*

*---------------------

* Binary and Multi-Bit Binary Input (BI, MBBI) --

*

* F = Function code to read raw value. Note that if the function code

* does not use the R/W dataway lines (e.g. F27), device-support will

* return the Q response.

*

* PARM = Bit number of desired bit to read (BI) or bit number of low-order

* bit to read (MBBI). Bit numbering is from 0 to 23.

*

*---------------------

* Binary and Multi-Bit Binary Output (BO, MBBO) --

*

* F = Function code to either read, write, set, or clear output value.

* Device support has two modes for writing binary values. If the

* function code is a group one or two read or write, the desired value

* is written using a read/modify/write sequence. The CAMAC branch

* is locked during this sequence so that it is atomic. If the function

* code is a group one or two set or clear, the desired value is set

* using a single selective set or clear operation (BO only).

*

* Note that multi-bit selective set/clear operations are implemented

* with two commands:

* 1) clear all the uncleared 0 bits in the new state

* 2) set all the unset 1 bits in the new state

* These two commands are executed with the CAMAC branch locked so

* that they are atomic to the software. However, they will not be

* atomic to the hardware. An intermediate state (after the clear

* command) is passed through before the final desired state is reached.

* If this is a problem for your hardware, you should use the

* read/modify/write sequence instead.

*

* PARM = Bit number of desired bit to write (BO) or bit number of low-order

* bit to write (MBBO) plus optional readback function code. As with

* BI and MBBI records, the bit numbering is from 0 to 23. The readback

* function code has the format "Rn" where "n" is the function code.

*

* Specifying a readback function code will enable the device-support

* software to read the current state of the hardware at record

* initialization time and store it in the RVAL field. This aids in

* performing "bumpless" reboots of the IOC. The readback function is

* also issued after every write and the result is stored in the RBV

* field.

*

* If the F parameter in a BO or MBBO record specifies a group 1 or group

* 2 read or write, then the read (or the corresponding read) function

* will automatically be used for the readback, without having to specify

* it in the PARM field.

*

*

*---------------------

* Waveform (WF) --

*

* F = Function code to read or write raw value

* Althought the waveform record is normally used to read arrays, the

* CAMAC device support for the waveform record also allows writing

* data if the F value is for a CAMAC write (F=16-23).

* On output the values are written directly from the VAL array to the

* device. On input the values are masked for the appropriate range

* and sign-extended if necessary.

*

* PARM = Expected range of input values (for CAMAC read functions), and

* Q transfer mode for the CAMAC block transfer operation.

* The range parameters are the same as for analog or longword

* input records.

* The Q transfer mode must be one of the following:

* QSTP Q-stop, i.e. continue transfers until the transfer

* count is reached or a Q=0 response is received.

* QRPT Q-repeat, i.e. repeat each transfer until Q=1 is

* response is received, or a hardware timeout occurs.

* QSCN Q-scan, i.e. increment A and N, starting from the

* values specifed in the B,C,N,A,F parameters, until the

* transfer count is reached or the last station address

* is reached

* If no Q transfer mode is specified in the PARM field then QRPT is used.

*

* Following are examples of valid PARM fields for WF records:

* 0xffffff:QSTP (24-bit, unipolar, Q-stop transfer mode)

* Bipolar:2047 (12-bit, bipolar, Q-repeat (default)

* transfer mode)

*

* Note: The waveform record permits any EPICS data type (DBF_CHAR,,

* DBF_SHORT, DBF_DOUBLE, etc.). However, the CAMAC device support only

* allows short and long integers, both signed and unsigned. FTVL

* values other than DBF_SHORT, DBF_USHORT, DBF_LONG, and DBF_ULONG will

* generate an error during record initialization.

*

*

*

*********** end of @ parameter definitions ****************************/

 

Hytec 2992 Board Settings

-----------------------------

Branch 0 :

not used at PPPL

VME short I/O base address 0xDE00

Interrupt IRQ3

Interrupt Vector = 0x80

Branch 1 :

VME short I/O base address 0xDE10???

Interrupt IRQ3

Interrupt Vector = 0x80

 

 

 

 

 

 

 

 

 

 

 

 

PPPL Code Changes

-----------------

  1. ht2992.h 13JAN00 PS

usual 2*Link_propogation_delay time. For CNAFS which can turn an L2 crate controller on, there is a 111 millisecond delay. If the L2 is already online or the link is operating normally the actual delay will be less.

 

 

CNAF Listings

--------------

To get a report from the IOC about which PV/records deal with CAMAC, (and other I/O) type :

IOC> dbhcr

To get the report into a file on the host computer :

IOC> dbhcr > filename

To sort the file, on the host type:

host% sort filename > filename.sorted