g+
g+ Communities
Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  Index 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013 
<== Date ==> <== Thread ==>

Subject: Re: about GPIB interface
From: Noboru Yamamoto <yamamoto@acsad1.kek.jp>
To: tech-talk@aps.anl.gov, wbrown@csg.lbl.gov
Date: Fri, 23 Jan 1998 11:17:40 +0900
Hi,

Bill wrote:
>> Is there anyone who can help with this.  We aren't using these devices
>> here.
>> Rozelle
> 
>I have no experience worth mentioning with support of GPIB on PCs, either
>under dos/windoze or EPICS.  I hope that the following will be helpful
>WRT EPICS on vme.
> 
>AFAIK, only 2 GPIB (IEEE-488) interfaces are supported by EPICS.
> 
>The first is the (in)famous NI-1014 from National Instruments, about which
>John Winans had much to say after getting driver and device support
>working.
> 
>The second is the Hewlett-Packard E2050A "LAN-HPIB Gateway" which has had
>support written by Ben Franksen at BESSY.  I don't know if this has been
>folded into the "official" release, or even as there are plans to do so.
>(IMHO it probably should be, but it's not my call!)

In KEK, we developed a software for Tektronics ET488, which has Ethernet
and GP-IB ports. Host can controll GP-IB device connected to ET-488
over Ethernet. It is not in official release but we are happy to send 
a source code. The code has been used on VxWorks on VME only.

> 
>Hmmm - I wonder what would be required to make this code run under EPICS/
>VxWorks on an Intel platform.
> 

< some sentencies dropped>

>Device support for the HP scope shouldn't be too big of a problem.  Take
>a look at devNewSkeletonGpib.c in the EPICS source.  About "all you need
>to do is" to edit command strings that the 'scope will understand into
>the param strings.  While it may not seem obvious how to do that, after
>you get the first one working it's fairly straight-forward.  Johns' note
>in the documentation on the web should be a good starting point.
> 
>All of my babbling here seems pretty bland to me, but something tells
>me I'd best include a disclaimer.

We wrote a small tool nambed GDL to help a our GP-IB user. GDL translates
the follwing description,
============================================================================
Device(Tek2430)

%{
/* Function proto types */
STATIC int rd_wf();
}%

NameTable offOn = "OFF", "ON";
EfastTable userOffOn = "USER OFF",  "USER ON";
EfastTable Ch1Range=
        "CH1 VOLTS:2E-3",  "CH1 VOLTS:5E-3",  "CH1 VOLTS:1E-2"
        ,  "CH1 VOLTS:2E-2",  "CH1 VOLTS:5E-2",  "CH1 VOLTS:1E-1"
        ,  "CH1 VOLTS:2E-1",  "CH1 VOLTS:5E-1",  "CH1 VOLTS:1"
        ,  "CH1 VOLTS:2",  "CH1 VOLTS:5"
;

SrqHandler=mySrqHandler UNSolicited_SRQ;

ParamTable{
        set_ch1_volt    {rec=ai, command="CH1? VOL\r", conv="CH1 VOLTS:%lf", 
leng=32}
        get_ch1_volt    {rec=ao, command="CH1 VOL:%.lf\r"}
}

=========================================================================
into the device support code attached at the end of this e-mail.

We didn't put it on the net, but someone has a interest on this tool,
we will make it avaiable on the net.

Noboru Yamamot
KEK, JAPAN

=========== output from GDL tool ========================================
/* @(#)GNC Version 1.0: : Tek2430 */
/******************************************************************************
 *
 * The following define statements are used to declare the names to be used
 * for the dset tables.   
 *
 * NOTE: The dsets are referenced by the entries in the command table.
 *
 ******************************************************************************/

#define	DSET_AI    devAiTek2430Gpib
#define	DSET_AO    devAoTek2430Gpib
#define	DSET_BI    devBiTek2430Gpib
#define	DSET_BO    devBoTek2430Gpib
#define	DSET_SI    devSiTek2430Gpib
#define	DSET_SO    devSoTek2430Gpib
#define	DSET_LI    devLiTek2430Gpib
#define	DSET_LO    devLoTek2430Gpib
#define	DSET_MBBI  devMbbiTek2430Gpib
#define	DSET_MBBO  devMbboTek2430Gpib
#define	DSET_WF    devWfTek2430Gpib

#include	<vxWorks.h>
#include	<taskLib.h>
#include	<rngLib.h>
#include	<types.h>
#include	<stdioLib.h>
#include	<string.h>

#include	<alarm.h>
#include	<cvtTable.h>
#include	<dbDefs.h>
#include	<dbAccess.h>
#include	<devSup.h>
#include	<recSup.h>
#include	<drvSup.h>
#include	<link.h>
#include	<module_types.h>
#include	<dbCommon.h>
#include	<aiRecord.h>
#include	<aoRecord.h>
#include	<biRecord.h>
#include	<boRecord.h>
#include	<mbbiRecord.h>
#include	<mbboRecord.h>
#include	<stringinRecord.h>
#include	<stringoutRecord.h>
#include	<longinRecord.h>
#include	<longoutRecord.h>
#include	<waveformRecord.h>

#include	<drvGpibInterface.h>
#include	<devCommonGpib.h>

#define STATIC static

STATIC long	init_dev_sup(), report();

# line 3 "../src/temp.gt"

/* Function proto types */
STATIC int rd_wf();

static	struct  devGpibParmBlock devSupParms;

/******************************************************************************
 *
 * Define all the dset's.
 *
 * Note that the dset names are provided via the #define lines at the top of
 * this file.
 *
 * Other than for the debugging flag(s), these DSETs are the only items that
 * will appear in the global name space within the IOC.
 *
 * The last 3 items in the DSET structure are used to point to the parm 
 * structure, the  work functions used for each record type, and the srq 
 * handler for each record type.
 *
 ******************************************************************************/

gDset DSET_AI   = {6, {report, init_dev_sup, devGpibLib_initAi, NULL,
	devGpibLib_readAi, NULL, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_aiGpibWork, (DRVSUPFUN)devGpibLib_aiGpibSrq}};

gDset DSET_AO   = {6, {NULL, NULL, devGpibLib_initAo, NULL,
	devGpibLib_writeAo, NULL, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_aoGpibWork, NULL}};

gDset DSET_BI   = {5, {NULL, NULL, devGpibLib_initBi, NULL,
	devGpibLib_readBi, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_biGpibWork, (DRVSUPFUN)devGpibLib_biGpibSrq}};

gDset DSET_BO   = {5, {NULL, NULL, devGpibLib_initBo, NULL,
	devGpibLib_writeBo, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_boGpibWork, NULL}};

gDset DSET_SI   = {5, {NULL, NULL, devGpibLib_initSi, NULL,
	devGpibLib_readSi, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_stringinGpibWork, (DRVSUPFUN)devGpibLib_stringinGpibSrq}};

gDset DSET_SO   = {5, {NULL, NULL, devGpibLib_initSo, NULL,
	devGpibLib_writeSo, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_stringoutGpibWork, NULL}};

gDset DSET_LI   = {5, {NULL, NULL, devGpibLib_initLi, NULL,
	devGpibLib_readLi, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_liGpibWork, (DRVSUPFUN)devGpibLib_liGpibSrq}};

gDset DSET_LO   = {5, {NULL, NULL, devGpibLib_initLo, NULL,
	devGpibLib_writeLo, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_loGpibWork, NULL}};

gDset DSET_MBBI = {5, {NULL, NULL, devGpibLib_initMbbi, NULL,
	devGpibLib_readMbbi, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_mbbiGpibWork, (DRVSUPFUN)devGpibLib_mbbiGpibSrq}};

gDset DSET_MBBO = {5, {NULL, NULL, devGpibLib_initMbbo, NULL,
	devGpibLib_writeMbbo, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_mbboGpibWork, NULL}};

gDset DSET_WF   = {5, {NULL, NULL, devGpibLib_initWf, NULL,
	devGpibLib_readWf, (DRVSUPFUN)&devSupParms,
	(DRVSUPFUN)devGpibLib_wfGpibWork, (DRVSUPFUN)devGpibLib_wfGpibSrq}};


/******************************************************************************
 *
 * Debugging flags that can be accessed from the shell.
 *
 ******************************************************************************/
int Tek2430Debug = 0;
extern int ibSrqDebug;		/* declared in the GPIB driver */
/******************************************************************************
 *
 * Use the TIME_WINDOW defn to indicate how long commands should be ignored
 * for a given device after it times out.  The ignored commands will be
 * returned as errors to device support.
 *
 * Use the DMA_TIME to define how long you wish to wait for an I/O operation
 * to complete once started.
 *
 * These are to be declared in 60ths of a second.
 *
 ******************************************************************************/
#define TIME_WINDOW	600		/* 10 seconds */
#define DMA_TIME	60		/* 1 second */
/******************************************************************************
 *
 * Strings used by the init routines to fill in the znam, onam, ...
 * fields in BI and BO record types.
 *
 ******************************************************************************/

static char                *offOnList[] = { "OFF", "ON" };
static struct devGpibNames offOn = { 2, offOnList, NULL, 1 };


/******************************************************************************
 *
 * String arrays for EFAST operations.  Note that the last entry must be 
 * NULL.
 *
 * On input operations, only as many bytes as are found in the string array
 * elements are compared.  If there are more bytes than that in the input
 * message, they are ignored.  The first matching string found (starting
 * from the 0'th element) will be used as a match.
 *
 * NOTE: For the input operations, the strings are compared literally!  This
 * can cause problems if the instrument is returning things like \r and \n
 * characters.  You must take care when defining input strings so you include
 * them as well.
 *
 ******************************************************************************/

static char *(userOffOn[])={"USER OFF","USER ON",NULL};
static char *(Ch1Range[])={"CH1 VOLTS:2E-3","CH1 VOLTS:5E-3","CH1 VOLTS:1E-2","CH1 VOLTS:2E-2","CH1 VOLTS:5E-2","CH1 VOLTS:1E-1","CH1 VOLTS:2E-1","CH1 VOLTS:5E-1","CH1 VOLTS:1","CH1 VOLTS:2","CH1 VOLTS:5",NULL};

/******************************************************************************
 *
 * Array of structures that define all GPIB messages
 * supported for this type of instrument.
 *
 ******************************************************************************/

static struct gpibCmd gpibCmds[] = { 

    /* CMMAND 0 set_ch1_volt */
  {&DSET_AI, GPIBREAD, IB_Q_LOW, "CH1? VOL\r", "CH1 VOLTS:%lf", 0, 32, NULL, 0, 0, NULL, NULL, -1 },

    /* CMMAND 1 get_ch1_volt */
  {&DSET_AO, GPIBWRITE, IB_Q_LOW, NULL, "CH1 VOL:%.lf\r", 0, 32, NULL, 0, 0, NULL, NULL, -1 }
};
/* The following is the number of elements in the command array above.  */
#define NUMPARAMS	sizeof(gpibCmds)/sizeof(struct gpibCmd)

/******************************************************************************
 *
 * Structure containing the user's functions and operating parameters needed
 * by the gpib library functions.
 *
 * The magic SRQ parm is the parm number that, if specified on a passive
 * record, will cause the record to be processed automatically when an
 * unsolicited SRQ interrupt is detected from the device.
 *
 * If the parm is specified on a non-passive record, it will NOT be processed
 * when an unsolicited SRQ is detected.
 *
 * In the future, the magic SRQ parm records will be processed as "I/O event
 * scanned"... not passive.
 *
 ******************************************************************************/

static struct  devGpibParmBlock devSupParms = {
  &Tek2430Debug,         /* debugging flag pointer */
  -1,                   /* device does not respond to writes */
  TIME_WINDOW,          /* # of clock ticks to skip after a device times out */
  NULL,                 /* hwpvt list head */
  gpibCmds,             /* GPIB command array */
  NUMPARAMS,            /* number of supported parameters */
  -1,			/* magic SRQ param number (-1 if none) */
  "devTek2430Gpib",	/* device support module type name */
  DMA_TIME,		/* # of clock ticks to wait for DMA completions */
  mySrqHandler,			/* SRQ handler function (NULL if none) */
  NULL			/* secondary conversion routine (NULL if none) */
};

/******************************************************************************
 *
 * Initialization for device support
 * This is called one time before any records are initialized with a parm
 * value of 0.  And then again AFTER all record-level init is complete
 * with a param value of 1.
 *
 ******************************************************************************/
STATIC long 
init_dev_sup(int parm)
{
  return(devGpibLib_initDevSup(parm,&DSET_AI));
}

/******************************************************************************
 *
 * Print a report of operating statistics for all devices supported by this
 * module.
 *
 * This function will no longer be required after epics 3.3 is released
 *
 ******************************************************************************/
STATIC long
report(void)
{
  return(devGpibLib_report(&DSET_AI));
}

/******************************************************************************
 *
 * c code
 *
 *****************************************************************************/

 

Navigate by Date:
Prev: Re: new record support Nick Rees
Next: Re: about GPIB interface Benjamin Franksen
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013 
Navigate by Thread:
Prev: Re: about GPIB interface Bill Brown
Next: new record support Jeffrey Mcdonald
Index: 1994  1995  1996  1997  <19981999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICSv4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·