Hi Mark,
thanks for your answer.
I was using this mask, because all 0-bits are marked as "reserved" in
the manual of our
motor driver. So I wanted to make sure they are not written...
Good to know how the shift is calculated...I should check my other
mbbo/mbbi records as well.
Florian
On 07/16/2013 06:16 PM, Mark Rivers wrote:
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: [email protected] [mailto:[email protected]] 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 Mark Rivers
- References:
- mbbxDirect SHFT field Florian Feldbauer
- RE: mbbxDirect SHFT field Mark Rivers
- Navigate by Date:
- Prev:
RE: single IOC on Linux with two ports Hill, Jeff
- Next:
Re: EPICS fsmRecord question Jiro Fujita
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: mbbxDirect SHFT field Mark Rivers
- Next:
RE: mbbxDirect SHFT field Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|