EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Question about a tutorial wiritten by Norum
From: Eric Norum <[email protected]>
To: marco_hair <[email protected]>
Cc: tech-talk <[email protected]>
Date: Tue, 30 Sep 2008 11:33:07 -0500
On Sep 30, 2008, at 11:14 AM, marco_hair wrote:

hi, Eric:

I follow your tutorial, but seems there is sth. wrong in my test code.
this is dbtr message:

epics> dbtr AB300:FilterWheel:fbk
ACKS: NO_ALARM ACKT: YES ADEL: 0 ALST: 0
ASG: BKPT: 0x00 DESC: Filter Wheel Position
DISA: 0 DISP: 0 DISS: NO_ALARM DISV: 1
DTYP: AB300 EGU: EVNT: 0 FLNK:CONSTANT 0
HHSV: NO_ALARM HIGH: 0 HIHI: 0 HOPR: 0
HSV: NO_ALARM HYST: 0 INP:GPIB_IO #L0 A0 @2
LALM: 0 LCNT: 0 LLSV: NO_ALARM LOLO: 0
LOPR: 0 LOW: 0 LSV: NO_ALARM MDEL: 0
MLST: 0 NAME: AB300:FilterWheel:fbk NSEV: NO_ALARM
NSTA: NO_ALARM PACT: 1 PHAS: 0 PINI: NO
PRIO: LOW PROC: 0 PUTF: 0 RPRO: 0
SCAN: Passive SDIS:CONSTANT SEVR: INVALID SIML:CONSTANT
SIMM: NO SIMS: NO_ALARM SIOL:CONSTANT STAT: UDF
SVAL: 0 TPRO: 0 TSE: 0 TSEL:CONSTANT
UDF: 1 VAL: 0
epics> 2008/10/01 00:11:33.540 192.168.1.103:4001 write 2
ª\201
epics> 2008/10/01 00:11:35.468 192.168.1.103:4001 read 4
U\020\000\020
2008/10/01 00:11:37.465 AB300:FilterWheel:fbk convert failed Invalid reply


I change the code in devAB300.c like this:
  {&DSET_LI, GPIBREAD, IB_Q_LOW, "\252\201\000\201", NULL, 0, 10,
   convertCurrentReply, 0, 0, NULL, NULL, NULL},

why can I only send 2 bytes to device through an Ethernet/serial box?

You've hit a shortcoming in the devGpib support. The problem is with the string you're trying to send. The devGpib code expects the command/format strings to be null-terminated and thus sees the '\000' in your command as the end of the string.
If there's no way to avoid sending the NUL character to instrument you'll have to specify GPIBCVTIO in the command table entry and perform all the I/O operations yourself in the custom conversion routine.


Here's a very simple example from device support for a MAX1619 digital thermometer. As you can see, the 'read local temperature' command code (Param 2) is a NUL.

/*
* Custom I/O routines
*/
static int
readRegisterValue(struct gpibDpvt *pdpvt, int P1, int P2, char **P3)
{
struct longinRecord *pli = ((struct longinRecord *)(pdpvt- >precord));
gpibCmd *pgpibCmd = gpibCmdGet(pdpvt);
asynOctet *pasynOctet = pdpvt->pasynOctet;
void *asynOctetPvt = pdpvt->asynOctetPvt;
size_t ntrans;
int eomReason;
char reply;


if ((pasynOctet->write(asynOctetPvt,pdpvt->pasynUser,pgpibCmd->cmd,
1,&ntrans) != asynSuccess)
|| (pasynOctet->read(asynOctetPvt,pdpvt->pasynUser,&reply,
1,&ntrans,&eomReason) != asynSuccess)
|| (ntrans != 1)) {
return -1;
}
if (P1)
pli->val = (signed char)reply;
else
pli->val = (unsigned char)reply;
pli->udf = 0;
return 0;
}
.
.
.
.
/* Param 0 -- Read manufacturer ID code */
{&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\xFE", NULL, 0, 1,
readRegisterValue, 0, 0, NULL, NULL, NULL},


    /* Param 1 -- Read Device ID code */
    {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\xFF", NULL, 0, 1,
        readRegisterValue, 0, 0, NULL, NULL, NULL},

    /* Param 2 -- Read local temperature */
    {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\x00", NULL, 0, 1,
        readRegisterValue, 1, 0, NULL, NULL, NULL},

    /* Param 3 -- Read remote temperature */
    {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\x01", NULL, 0, 1,
        readRegisterValue, 1, 0, NULL, NULL, NULL},


-- Eric Norum <[email protected]> Advanced Photon Source Argonne National Laboratory (630) 252-4793




References:
Re: Question about a tutorial wiritten by Norum Eric Norum
Question about a tutorial wiritten by Norum Silver
Re:Re: Question about a tutorial wiritten by Norum marco_hair

Navigate by Date:
Prev: Re:Re: Question about a tutorial wiritten by Norum marco_hair
Next: RE: vxWorks 6.6 compile problem for EPICS R3.14.10-RC1 Williams Jr., Ernest L.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re:Re: Question about a tutorial wiritten by Norum marco_hair
Next: Re: Question about a tutorial wiritten by Norum Ben Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  <20082009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·