A PC-based Auto-testing System for BEPC CAMAC Modules
H.Zhang

J.J.XuH.Ren

Institute of High Energy Physics, Beijing 100039
E-mail: hzhang@bepc3.ihep.ac.cn

1 Introduction
A great deal of CAMAC modules are used in BEPC,
however we are without an effective testing system. We
imported a CAMAC testing system from SLAC twelve
years ago, it played an important role in BEPC
construction and operation during the beginning stage, but
the system failed several years ago, it is too old to berestored. It is critical to verify that all on-line CAMAC
modules are running properly at any time. It is possible
for the entire BEPC control system to shutdown if on-line
CAMAC modules have trouble. We are required to build anew CAMAC test system for BEPC normal operation.
We designed and developed a PC-based standalone
system for testing CAMAC modules since PC is now
more popular and less expensive.
All CAMAC modules in the BEPC control system comefrom abroad. They are IDIM, IDOM, SAM, PSC, 3016,SCC, SBD, 3922, 3388, 3530, trigger, CV and so on. Of
them, there are IDIM, IDOM, SAM, PSC, 3016 to beautomation testing because they are approximately 80
percent of the whole on-line CAMAC modules in number.
The other modules are also tested.
2 Operation characteristics
Operators are able to run this new test system easily.
First they turn on the PC, CAMAC crate, auxiliary NIM
crate, and digital voltmeter after the cables are connected.
The power is supplied to the stand for at least one hour inorder for the analog signal measurement to be made. The
standard modules with this system have the SAM
TESTER at slot 18 in CAMAC crate, IDIM at 4, IDOM at
8, 3016 at 16 using as signal reference sources. DTM-399
at slot 23 can be used to monitor the testing process and tocheck system security.
The first window has a CAMAC icon in it, by clicking
the icon and logging on, you enter the << CAMAC Test
System >> window. A hardware connection message
about testing can be found in <<information>> and<<help>> menu. When you choose open module option
under <<file>> menu, the open module window isdisplayed[2].
Operators click the crate number, slot number for themodule to be tested, and the working mode selections on
the open module window to begin the test. We designed 6
working modes for this system: <<general>>, <<3016>>,<<SAM>>, <<IDIM>>, <<IDOM>>, <<PSC>>. The<<General>> mode is supposed to test any CAMAC
module with NAF functions by means of various input
parameters. Other modes are used for specific module
auto - testing after the <<auto>> button is pressed on their

particular windows, or for special item testing when it isselected. The test system can also print or store the test
results including the name of the test person and the test
time for later use.
Operators sit in front of the instrument and just press
the keyboard and mouse buttons to finish testing without
other special tools.
3 Hardware configuration
The test system hardware consists of 4 parts: a PC
with interface modules KSC-2927 and AX-5488 in the ATslots; a NIM crate with three home-made auxiliary
modules A9-15, A9-16, A9-17, a CAMAC crate with aKSC-3922 crate controller and standard test modules:
3016, SAM tester, IDIM, IDOM in the appropriate slots
and a 6 1/2 digital voltmeter HP-3456A, see Fig 1.
NIM Crate
A A A9 9 915 16 17

P C

CAMAC Crate
D3 S
I IT0 AD DMI O
1 M
M M
6 tester 399

39222 59 42 87 8Digital Voltmeter
3456A
Fig. 1. Testing System for BEPC CAMAC modules
All standard test signal sources come directly fromCAMAC modules. The IDOM is selected as a digital test
signal reference which has 32 digital channels withflexible and configurable outputs. The SAM tester, whichcame from SLAC, is the analog signal test reference
which is dedicated for testing the SAM module. The SAM
tester has 32 channel direct voltage references with goodlinearity and smooth adjustment in range of -10V to+10V with the high stability of less than +/-0.0001. Its
BNC output connector is convenient for the measurementof the SAM tester module output references through theuse of the accurate digital voltmeter. 3016 is anotheranalog signal standard module with 16 channel outputs of
16-bit resolution. Its linearity is excellent with +/0.003%. It is one of ideal analog references. We also usethe IDIM as a digital input standard module with 32
digital channels.

For a more efficient test, we designed and developed
three types of NIM auxiliary test modules.
The interface between IDOM and IDIM is the NIM
digital module A9-15 which has 32 channel inputs from a
IDOM and 32 channel outputs to the IDIM with 32 LEDs
on the front panel. IDOMs opto-coupled outputs are notdirectly routed to the IDIM with opto-coupled inputs. We
can check if the IDOM outputs logic is correct via LEDs
display.
The NIM module A9-16 is appropriate for analog
measurement. The 16 channel analog signals ranging from-10V to +10V go from 3016 to the A9-16 inputs. Only
one analog signal is multiplexed to the BNC connector on
the front panel which is then connected to the 3456A. A
multiplexed analog signal for the A9-16 can reach an
accuracy of less than +/-0.005 (including the 3016 error
with +/-0.002 between theory values and output values)
after analyzing numerous acquired data. Channel selection
can be fulfilled through 4 channel IDOM digital inputs. It
should be a short connection from 3016 to 3456A throughspecial cable when it is necessary for more accuratereport. Test requirements determine whether or not ananalog reference from 3016 to SAM is required.
The NIM module A9-17 is dedicated for testing theCAMAC module PSC. PSC is a powerful control module
for accelerator main magnet supplies with a 14-bit digital
DAC and digital I/O with opto-couplers that are used inour ring control. LEDs on A9-17s front panel display the14-bit digital DAC output and 6 digital outputs comingfrom PSC, 8 digital inputs from standard IDOM. There isa BNC connector on its front panel in order to route tooscilloscope COS6100G for 14-bit digital DAC clock test.
Practice proves that these home-made NIM modules arehelpful in convenient test.
4 Application software development
The test system software design goals are to implement
a current popular graphic man-machine interactive
interface for the operator’ sconvenience and to auto-test 5
types of CAMAC modules with as many function tests aspossible. These modules are employed in great numbers in
on-line accelerator control.
Application software is comprised of 5 parts: CAMAC
DOS driver, DOS-Windows DOS interface program, MSWindows CAMAC dynamic link library, MS-WindowsGPIB-488 dynamic link library including applications,and man-machine windows interface program package.
All of them are developed in-house except for theCAMAC DOS driver. The brief introductions follow. For
the application software architecture, see Fig 2.
The CAMAC DOS driver[1] is market available. It
operates with the KSC-2927 under MS-DOS. It provides
several I/O library functions such as CAOPEN, CACLOS,
CAM16, CAM24, CAB16, CAB24, CACTRL, CCSTAT,
and so on.
DOS-Windows DOS interface CAMACTSR.C is aTSR program running under MD-DOS. It is programmedusing TURBO C 2.0. Actually, it is a interrupt service
using a vacant soft interrupt number 0F8. It creates a2KBYTES common data exchange area in the memory soas to prepare data and the area starting address of realmode for I/O between MS-DOS and MS-Windows.
MS-Windows CAMAC dynamic link librarycamacDLL.C is designed to provide an interface invokedby Visual Basic as well as a data exchange service with
CAMACTSR.C. The program package camacDLL.C isprogrammed by Visual C++ 1.5. In order to assure dataaccess correction, the right identification to MS-DOS dataexchange area is very important. We correctlytransformed data area starting address from real mode tovirtual mode and made the numbers of data types tominimum for VB usage.
VBMDI
Graphic Interactive Interface
Dynamic Link LibrarycamacDLL.C
under MS-Windows

Interrupt Service
CAMACTSR.C
under MS-DOS

DATA
print & store

Dynamic Link Library
gpib.DLL
under MS-Windows
3456A Driverunder MS-Windows

2927 Driverunder MS-DOS
Test System for CAMAC Modules
Fig 2. Application Software Architecture

MS-Windows GPIB-488 dynamic link library is market
available with 17 interface functions complying withGPIB-488 protocol. First, we set the digital meter GPIB
address to 22, then restore it to initiate status, put it tolistener, write control words and read the measurement
results, and so on.
The man-machine windows interface program package iscreated by Visual Basic which is an object-oriented
programming tool. The man-machine interface is a multipages and multi-windows with MDI style.
For more information about the application software
introduction , see[2].
5 Test functions
The overall considerations are to test automatically for
5 types of IDIM, IDOM, PSC, 3016, SAM. Other types ofCAMAC modules are tested manually.
The tests for IDIM are Q/X response, single digital input
scan, random digital input scan and status level transition
test. Digital reference signals come from standard IDOM,
but status level signals are abtained from standard 3016.
The tests for IDOM are Q/X response, single digital
output scan, random digital output scan, selective bitset/clear and bit pulse on/off. All the test processes aredisplayed using LEDs on the front panel of the A9-15 or
are read by the computer using the A9-15 and standardIDIM.
The tests for PSC are Q/X response, ramping rate time,
digital output scan and digital input scan. PSC can run in
one of seven ramping rates by means of code control. We
can test these seven ramping rates separately within +/-0.5
second or observe its digital DAC LEDs change rate on
the A9-17s front panel. The digital output and input logic
also displays on the front panel of A9-17. Testing thecorrection of digital inputs needs standard IDOMs
reference signals.
In respect to 3016, we test its output nonlinearity foreach channel besides Q/X response. We generally use theA9-16 and IDOM as standard test modules to perform theautomatic measurement. The graphic from thenonlinearity results can display on 3016 test windows
because the 3016 outputs data can be read back fromdigital meter 3456A through GPIB-488. If more accurate
data are needed then a direct link between the 3016 output
channel and the 3456A is necessary. However, we thoughtthat 3016 outputs can be directly connected to standard
SAM inputs for testing 3016, but it is not yet adopted.
SAM has two working modes: normal scan mode andfast scan mode. We concentrate on the performance test
under the normal scan mode that is our working mode inpractice. The test items have Q/X response, linearity andAC function. The standard SAM tester module is selected
as an adjustable analog signal reference. It has 32 channel
outputs which adapt coincidentally to the 32 channel
inputs of the SAM. In parallel, one of the outputs can beconnected to a digital voltmeter for SAMs linearity
measurement. Its result will be shown on SAM test
windows in graphic form. AC function test is an important
index for SAM to see if the SAM can reject 60 Hz noisesignal.

Other CAMAC modules like SBD, SCC, CV, etc.,
can also be tested by this system by selecting<<general>> button on the open module window.
By choosing the NAF for a particular module you
can read/write data from/to the module in threemodels: Q/X responses, single data transfers andblock data transfers according to your interest.
6 Questions and considerations
It took us about one year to build this CAMAC testsystem. Its design aims at keeping BEPC on-line CAMACmodules in good condition. It does not try to make anoverall performance test for every CAMAC module.
This new test system has been in operation since June ofthis year. We plan to verify all CAMAC modules which
are used as spare parts and fix all broken modules during
BEPC shutdown by using this new test system. Now, thesystem works well in spite of need for more practice todevelop its potential.
Correct operation for the system is very important. It
relies on two aspects. Firstly, every standard module
including three NIM and five CAMAC work well,therefore we must find solution to assure these standard
modules are robust each time test begins. Besides this, We
should make reliable connections for each tested type of
CAMAC modules, and should minimize changes inmeasurement cables.
Determining the exact malfunction locations is significant
if the module to be tested fails. The question is which
instrumentation card can collect such information that canbe accessed by the computer. This is our next challenge.
This system is an off-line standalone one. We think thatthe better way to find malfunctions for CAMAC modules
is on-line test in a regular period through some application
software when times are feasible. It is particularly
important for analog modules like the 3016 and the SAM.
This test procedure allows us to detect a problem withlinear response timely and avoid any problem tooperations.
References[1][2]

Kinetic System Corporation. Model 2927
CAMAC/IBM PC Interface and 6110G Software,
Release 1.1, 1992.
H.Zhang, J.J.Xu, <<Software Design of Autotesting system for CAMAC Modules>>, proceedings on The China 9th Symposium on
Computer Application in Modern Science &Technology, p405-410, 1997.