lrs2365.c

Go to the documentation of this file.
00001 /*********************************************************************
00002 
00003   Name:         lrs2373.c
00004   Created by:   Stefan Ritt
00005 
00006   Cotents:      Routines for LeCroy 2365 Octal Logic Matrix
00007                 
00008   $Id: lrs2365.c 2753 2005-10-07 14:55:31Z ritt $
00009 
00010 *********************************************************************/
00011 
00012 #include <stdio.h>
00013 #include <dos.h>
00014 #include <string.h>
00015 
00016 #include "midas.h"
00017 #include "mcstd.h"
00018 
00019 #include "lrs2365.h"
00020 
00021 /*------------------------------------------------------------------*/
00022 
00023 int lrs2365_set(int crate, int slot, WORD coeff[18])
00024 /**********************************************************************\
00025    
00026    Description:
00027 
00028    Load the logic matrix of the LRS2365 with 18 coefficients according
00029    to the specifications in the manual. After loading, the matrix
00030    is verified.
00031 
00032 \**********************************************************************/
00033 {
00034    int i, status;
00035    WORD data;
00036 
00037    /* Initialize 2365 */
00038    camc(crate, slot, 0, 9);
00039 
00040    /* Set mode control to zero (front-panel input) */
00041    camo(crate, slot, 3, 16, 0);
00042 
00043    /* Write coefficients */
00044    for (i = 0; i < 18; i++)
00045       camo(crate, slot, 0, 16, coeff[i]);
00046 
00047    /* validate coefficients */
00048    status = SUCCESS;
00049    for (i = 0; i < 18; i++) {
00050       cami(crate, slot, 0, 0, &data);
00051       if (data != coeff[i]) {
00052          cm_msg(MERROR, "lrs2365_set",
00053                 "Error verifying coefficients: should be %d, read %d", coeff[i], data);
00054          status = 0;
00055       }
00056    }
00057 
00058    return status;
00059 }

Midas DOC Version 3.0.0 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Exaos Lee - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk