The CAMAC record is designed to perform generic CAMAC I/O. The CAMAC Branch (B), Crate (C), Slot (N), Subaddress (A), Function code (F) and transfer mode are all controlled by record fields which can be modified at run time. Applications for this record include accessing CAMAC modules for which no device support exists, and for performing CAMAC diagnostics.
The CAMAC record is intended only for this specialized CAMAC I/O function. The CAMAC record directly calls the ESONE compatible CAMAC library, without an intermediate device support layer.
The CAMAC record supports array operations, i.e. CAMAC block transfer operations. The VAL field contains the data to be written or the data read. Depending upon the CAMAC hardware being used this may use DMA from the CAMAC controller to the VME bus memory.
This record requires the use of an underlying ESONE compatible CAMAC library. A library which supports serial highway drivers and the Kinetic Systems 2917/3922 parallel bus crate controller is now available. This library should be available as an EPICS extension in the near future.
If a CAMAC operation returns Q=0 it will be reflected in the Q field of the record, but will not raise an alarm. X=0 will raise a minor alarm. Any other errors detected in the CAMAC library will raise a major alarm.
Name | Access | Prompt | Data type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
VAL | R/W* | "Current value" | DBF_LONG (array) | The data to be written to CAMAC or the data read from CAMAC. This is always an array of LONGS. The maximum array length is determined by NMAX at IOC initialization. The actual array length is equal to NACT. | ||||||||||||
Q | R | "Q response" | DBF_LONG | The CAMAC Q response of the previous operation. This field is only guaranteed to be valid if TMOD="Single". | ||||||||||||
X | R | "X response" | DBF_LONG | The CAMAC X response of the previous operation. This field is only guaranteed to be valid if TMOD="Single". | ||||||||||||
INHB | R | "Inhibit status" | DBF_LONG | The status of the crate Inhibit signal (0=clear, 1=set). | ||||||||||||
B | R/W | "Branch" | DBF_LONG | The CAMAC Branch to use for the operation. Branch numbers start at 0. | ||||||||||||
C | R/W | "Crate" | DBF_LONG | The CAMAC Crate to use for the operation. Crate numbers start at 0 or 1 depending upon the hardware type. | ||||||||||||
N | R/W | "Station" | DBF_LONG | The CAMAC station (or slot) to use for the operation. Valid station numbers are typically 1-23 and 30. | ||||||||||||
A | R/W | "Subaddress" | DBF_LONG | The CAMAC subaddress to use for the operation. Valid subadresses are 0-15. | ||||||||||||
F | R/W | "Function" | DBF_LONG | The CAMAC function code to use for the operation. Valid function are codes 0-31. Function codes in the range 0-7 are CAMAC read operations, function codes in the range 16-23 are CAMAC write operations, and function codes in the range 8-15 and 24-31 are CAMAC control operations. | ||||||||||||
TMOD | R/W | "Transfer mode" | DBF_RECCHOICE | The data transfer mode. The choices are:
| ||||||||||||
NMAX | R | "Max. number of values" | DBF_LONG | The allocated length of the VAL array. It cannot be modified after the IOC is initialized. | ||||||||||||
NUSE | R/W | "Number of values to R/W" | DBF_LONG | The number of values to attempt to transfer when the record processes. This number is ignored if TMOD is "Single". It must be less than or equal to NMAX. | ||||||||||||
NACT | R | "Actual number of values R/W" | DBF_LONG | The actual number of values which were transferred in the last CAMAC operation. This number may be less than NUSE if a Q Stop, Q Repeat or Q Scan operation terminated prematurely due to a Q=0 or timeout. | ||||||||||||
CCMD | R/W* | "Crate Command" | DBF_RECCHOICE | A crate controller command. The choices are:
| ||||||||||||
Private Fields | ||||||||||||||||
BPTR | N | "Buffer Pointer" | DBF_NOACCESS | The pointer to the buffer for the VAL field. | ||||||||||||
|
The following table briefly describes all of the files required to implement the CAMAC record. The reader is assumed to be familiar with the EPICS Application Source/Release Control document which describes how to build an EPICS application tree into which these files are to be placed, and how to run "makesdr" and "gnumake" to build the record support. These files can all be obtained in a compressed tar file. This file should be untarred in a <top>/<app>App/ directory.
Files to be placed in <top>/<app>App/src/ | |
---|---|
recCamac.c | The source file for the record |
Makefile.Vx | This file is not included in the distribution. However, the user must
edit this file and add lines similar to the following: CAMAC_SRCS = ../recCamac.c SRCS.c = $(CAMAC_SRCS) $(other sources here) CAMAC_OBJS = recCamac.o LIBNAME = mylib.o LIBOBJS = $(CAMAC_OBJS) $(other objects here) USR_CFLAGS = -I$(EPICS)/replace_ascii -I$(EPICS)/cat_ascii \ -I$(EPICS)/sdrH/rec -I$(EPICS)/include/rec \ -I$(EPICS_EXTENSIONS_INCLUDE) |
Files to be placed in <top>/cat_ascii/ | |
camacRecord.ascii | This file defines all of the fields for the CAMAC record. |
choiceRecCAMAC.ascii | This file defines all of the choice values for the CAMAC record. |
choiceCAMAC.h | This file is included by choiceRecCAMAC.ascii and by recCamac.c. |
choiceRec.ascii | This file is not included in the distribution. However, the user must
edit this file and add the line: #include <choiceRecCAMAC.ascii> |
dbRecType.ascii | This file is not included in the distribution. However, the user must
edit this file and add the line: "camac" |
Files to be placed in <top>/<app>App/op/adl/ | |
CAMAC_IO.adl | This file builds an medm screen to access the CAMAC record.
To use it from the command line, type the following: cars1> medm -x -macro REC=my_camac_record CAMAC_IO.adl where my_camac_record is the name of a CAMAC record in an IOC. This file can also be used as a related display from other medm screens by passing the argument REC=my_camac_record. |
The following IDL program demonstrates the use of the Generic CAMAC record. It does a block-mode read of a scaler in slot 14 and plots the results. It also demonstrates using the "Crate Command" (CCMD) field to clear the Inhibit line.
; This IDL program demonstrates the use of the ; Generic CAMAC record. ; It does a Q-repeat read of a scaler in slot 14 ; and plots the results. ; The name of the generic CAMAC record rec = 'test_camac1' ; Set up B, C, N, A for scaler 0 (first scaler) ; in slot 14 on crate 0, branch 0. t = caput(rec+'.B', 0) t = caput(rec+'.C', 0) t = caput(rec+'.N', 14) t = caput(rec+'.A', 0) ; Make sure the crate Inhibit line is clear, ; because it would stop the scaler t = caput(rec+'.CCMD', "Clear Inhibit") ; Set the transfer mode to Q-repeat t = caput(rec+'.TMOD', "Q Repeat") ; Set up to read the scaler 1024 times t = caput(rec+'.NUSE', 1024) ; Read the scaler into the record VAL field ; by forcing the record to process t = caput(rec+'.PROC', 1) ; Make sure we got the number of values we expected t = caget(rec+'.NACT', nact) if (nact eq 1024) then $ print, 'Read CAMAC scaler OK' $ else $ print, 'Error reading CAMAC scaler' ; Read the data into IDL - only valid data t = caget(rec, data, max=nact) ; Plot the data plot, data end