camac - Generic CAMAC Record

Mark Rivers

Contents

Overview

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 part of the camac module.

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.


Record Field Descriptions

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:
"Single" Single-cycle CAMAC transfer. NUSE is ignored.
"Q Stop" Q-stop block mode transfer. The controller attempts to perform NUSE CAMAC cycles, but stops if there is a Q=0 response.
"Q Repeat" Q-repeat block mode transfer. The controller attempts to perform NUSE CAMAC cycles. It repeats any operations which have Q=0 response (up to some hardware-dependent timeout).
"Q Scan" Q-scan block mode transfer. The controller attempts to perform NUSE CAMAC cycles, automatically incrementing the subaddress and station number. The operation will terminate if the last slot is reached before NUSE successful cycles have completed.

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:
"None" This is the default. No crate controller command is executed.
"Clear Inhibit" Clears the crate Inhibit signal.
"Set Inhibit" Sets the crate Inhibit signal.
"Clear (C)" Executes a crate Clear (C) cycle
"Initialize (Z)" Executes a crate Initialize (Z) cycle
Note: If the CCMD field is set to any value except "None" then the following occurs: the record processes, the appropriate crate controller command is executed by the crate controller specified in the B and C fields, and CCMD is set back to "None". The record processing only performs the crate controller command, i.e. it does not also perform the CAMAC operation indicated by N, A, F.

Private Fields
BPTR N "Buffer Pointer" DBF_NOACCESS The pointer to the buffer for the VAL field.
Note: In the Access column above:
R Read only
R/W Read and write are allowed
R/W* Read and write are allowed; write triggers record processing if the record's SCAN field is set to "Passive".
N No access allowed



Example

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


Suggestions and comments to: Mark Rivers : (rivers@cars.uchicago.edu)