Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: RE: mbbxDirect SHFT field
From: Mark Rivers <rivers@cars.uchicago.edu>
To: "'Florian Feldbauer'" <florian@ep1.ruhr-uni-bochum.de>, EPICS Tech Talk <tech-talk@aps.anl.gov>
Date: Tue, 16 Jul 2013 16:16:34 +0000
Hi Florian,

If you look at the asyn/devEpics/devAsynUInt32Sigital.c device support you will see that for mbbi, mbbo, mbbiDirect and mbboDirect records the SHFT field is computed by the computeShift function in the record initialization function.

This is the computeShift function:

static int computeShift(epicsUInt32 mask)
{
    epicsUInt32 bit=1;
    int i;

    for(i=0; i<32; i++, bit <<= 1 ) {
        if(mask&bit) break;
    }
    return i;
}

So it sets SHFT to the first non-zero bit in the mask.

You have set the mask to 0x1f3c, which is 0001 1111 0011 1100 in binary.  The first non-zero bit is bit 2 (starting from 0) so SHFT is set to 2.

So I think you need to use B0 and B1 for your switches, because the mask says that the mbboDirect value starts at bit 2, not bit 0 in the hardware register.

Mark



-----Original Message-----
From: tech-talk-bounces@aps.anl.gov [mailto:tech-talk-bounces@aps.anl.gov] On Behalf Of Florian Feldbauer
Sent: Tuesday, July 16, 2013 10:15 AM
To: EPICS Tech Talk
Subject: mbbxDirect SHFT field

Hey all,

for the settings of the stop switch mode of a motor driver, we are 
using, a 16 bit code is used.
Bit 2 and Bit 3 are coding the polarity of the "left" and "right" stop 
switch, respectively.

I'm currently using bo records for each bit and one mbboDirect record to 
send all 16 bits at once to the device. As device support the 
asynUInt32Digital interface is used with a custom asynPortDriver:

record( mbboDirect, "PANDA:$(subsys):MOTOR:$(sector):SAP:SWITCHMODE" ) {
   field( DTYP, "asynUInt32Digital" )
   field( OUT,  "@asynMask($(BUS),14,0x1f3c,1)TMCM142_SAP_U" )
}
record( bo, "PANDA:$(subsys):MOTOR:$(sector):SAP:LEFTSWITCHPOLARITY" ) {
   field( OUT,  "PANDA:$(subsys):MOTOR:$(sector):SAP:SWITCHMODE.B2 NPP" )
   field( ONAM, "active high" )
   field( ZNAM, "active low" )
}
record( bo, "PANDA:$(subsys):MOTOR:$(sector):SAP:RIGHTSWITCHPOLARITY" ) {
   field( OUT,  "PANDA:$(subsys):MOTOR:$(sector):SAP:SWITCHMODE.B3 NPP" )
   field( ONAM, "active high" )
   field( ZNAM, "active low" )
}

When I now set "PANDA:$(subsys):MOTOR:$(sector):SAP:RIGHTSWITCHPOLARITY" 
to one,
PANDA:$(subsys):MOTOR:$(sector):SAP:SWITCHMODE.VAL is 8.
So far so good.
But the value in asynPortDriver::writeUInt32Digital is 0x20.
Having a closer look to the mbboDirect record shows that SHFT is 2.
Setting it to 0 inside the db-file has no effect.
Any idea why it is set to 2? How can I change this behavior?

The same problem occurs for the mbbiDirect record used to read back the 
settings.

Best regards,
Florian

-- 
----------------------------------------
| Dr. Florian Feldbauer                |
|                                      |
| Helmholtz-Institut Mainz /           |
| Johannes Gutenberg-Universität Mainz |
| Johann-Joachim-Becher-Weg 45         |
| D-55128 Mainz                        |
|                                      |
| Office: 01/102                       |
| Phone:  (+49)6131 / 39-27373         |
----------------------------------------



Replies:
Re: mbbxDirect SHFT field Florian Feldbauer
References:
mbbxDirect SHFT field Florian Feldbauer

Navigate by Date:
Prev: Job Opening: Control System Software Engineer Position at SNS/ORNL Kasemir, Kay
Next: Re: Job Opening: DAQ and Controls Software Engineer Position at SNS/ORNL Hartman, Steven M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: mbbxDirect SHFT field Florian Feldbauer
Next: Re: mbbxDirect SHFT field Florian Feldbauer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·