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  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  2025  <2026 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  2025  <2026
<== Date ==> <== Thread ==>

Subject: Re: asynInt32 device support for mbbiDirect record for representing bitmasks
From: Mark Rivers via Tech-talk <tech-talk at aps.anl.gov>
To: EPICS Tech Talk <tech-talk at aps.anl.gov>, "Wlodek, Jakub" <jwlodek at bnl.gov>
Date: Mon, 2 Feb 2026 18:51:27 +0000
Hi Jakub,

Here are a few drivers that call setUIntDigitalParam:


Mark




From: Mark Rivers <rivers at cars.uchicago.edu>
Sent: Monday, February 2, 2026 12:38 PM
To: Érico Nogueira Rolim via Tech-talk <tech-talk at aps.anl.gov>; Wlodek, Jakub <jwlodek at bnl.gov>
Subject: Re: asynInt32 device support for mbbiDirect record for representing bitmasks
 
Hi Jakub,

  • I'd have to use asynUInt32Digital - I tried this, but it's value did not seem to update with setIntegerParam like I'd have expected

You use setUIntDigitalParam(), not setIntegerParam().


  • # Add a mask argument, since asynUInt32Digital requires asynMask here. Is 0x4 correct if I have a 4 bit bitmask as an example?

No, assuming it is the low-order 4 bits then the mask is 0xF.

Mark



From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Wlodek, Jakub via Tech-talk <tech-talk at aps.anl.gov>
Sent: Monday, February 2, 2026 9:29 AM
To: Érico Nogueira Rolim via Tech-talk <tech-talk at aps.anl.gov>
Subject: asynInt32 device support for mbbiDirect record for representing bitmasks
 
Hi all,

I am writing an asynPortDriver for a device that has many possible configurations, and as such upon connection I query the device to see which features it currently has enabled, and I store this information in a bitmask (to avoid making many records for all of the possible features). I'd still like to be able to access each bit easily from clients outside of the IOC without needing bit manipulation/logic, so it seems to me that an mbbiDirect record is a good option, since I can read the individual bits with the B0 - B* fields.

I currently have this working with two records - one an ai with asynInt32 device support, which forward-links to an mbbiDirect Soft Channel:

record(ai, "$(P)$(R)FeaturesBitmaskRaw_RBV"){
    field(DESC, "Features bitmask raw rb")
    field(DTYP, "asynInt32")
    field(INP, "@asyn($(PORT),$(ADDR),$(TIMEOUT))XSPD_FEAT_BITMASK")
    field(FLNK, "$(P)$(R)FeaturesBitmask_RBV")
    field(SCAN, "I/O Intr")
}

record(mbbiDirect, "$(P)$(R)FeaturesBitmask_RBV") {
    field(DESC, "Features bitmask rb")
    field(INP, "$(P)$(R)FeaturesBitmaskRaw_RBV NPP NMS")
    field(B0, "0")
    ...
    field(DTYP, "Soft Channel")
    field(SCAN, "I/O Intr")
}

I'm wondering if there is a way to do this more directly - meaning that I can set the value of the mbbiDirect from my asynPortDriver directly. It seems to me that asynInt32 does not work with mbbiDirect, and I'd have to use asynUInt32Digital - I tried this, but it's value did not seem to update with setIntegerParam like I'd have expected. I had it set up like this:

record(mbbiDirect, "$(P)$(R)FeaturesBitmask_RBV") {
    field(DESC, "Features bitmask rb")
    # Add a mask argument, since asynUInt32Digital requires asynMask here. Is 0x4 correct if I have a 4 bit bitmask as an example?
    field(INP, "@asynMask($(PORT),$(ADDR),0x4,$(TIMEOUT))XSPD_FEAT_BITMASK")
    field(B0, "0")
    ...
    field(DTYP, "asynUInt32Digital")
    field(SCAN, "I/O Intr")
}

createParam(ADXSPDModule_FeatBitmaskString, asynParamUInt32Digital, &ADXSPDModule_FeatBitmask);

int featureBitmask = // Get my features bitmask from the hardware
setInteger(ADXSPDModule_FeatBitmask, featureBitmask);

but the record does not appear to be processed (UDF_ALARM) on IOC startup. When I switch to my two-record-solution, I just change the second argument of createParam to asynParamInt32 to match the device support, and I get a correct value read back. Am I missing something obvious? I also don't see any issues in the IOC shell during startup, and the code compiles OK.

As an aside, it would be nice if I could also give names to each of the bits in an mbbiDirect/mbboDirect, like with mbbo/mbbi record values. This would be helpful for creating UIs and other client programs. From the record reference manual, I don't see any fields that would allow for this, is that correct?

Thanks!
Jakub


References:
asynInt32 device support for mbbiDirect record for representing bitmasks Wlodek, Jakub via Tech-talk
Re: asynInt32 device support for mbbiDirect record for representing bitmasks Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: asynInt32 device support for mbbiDirect record for representing bitmasks Mark Rivers via Tech-talk
Next: Re: udpiiu messages Hill, Jeff via Tech-talk
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  2025  <2026
Navigate by Thread:
Prev: Re: asynInt32 device support for mbbiDirect record for representing bitmasks Mark Rivers via Tech-talk
Next: MODBUS User-Defined Function Codes William Jamieson via Tech-talk
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  2025  <2026
ANJ, 19 Mar 2026 · Home · News · About · Talk · Base · Modules · Extensions ·
· Distributions · Download · Documents · Links · Licensing ·