Skip to content

Setting intf.src_term_start_trigger results in error with cDAQ & NI9862 #299

@tjschweizer

Description

@tjschweizer

I was/am unable to set the source terminal start trigger for any interface session. This is useful for syncing between DAQmx and XNET. This is using a cDAQ-9189 with an NI-9862 XNET module.

Steps Involved:
Create any input or output session and try to set the intf.src_term_start_trigger. I received the following error:

nixnet.errors.XnetError: NI-XNET: (Hex 0xBFF630C0) A property value was out of range or incorrect. Solution: Specify a correct value.

I checked the output in NI IO Trace, and saw that when the value was read using nxGetProperty, the length was 1 more than the number of characters. For example:

nxGetProperty (0x00400001, "nxPropSession_IntfSrcTermStartTrigger", 32 (0x20), "/cDAQ9189-xxxxxxx/Slot6/Convert")

"/cDAQ9189-xxxxxxx/Slot6/Convert" has 31 characters, but a length of 32. It seems XNET wants the length+1 for the string. This is not followed when setting the property. The command to set the property:

nxSetProperty (0x00400001, "nxPropSession_IntfSrcTermStartTrigger", 33 (0x21), "/cDAQ9189-xxxxxxx/ai/StartTrigger")

Has 33 characters for the trigger source, and a length of 33. This was returning the error above.

I modified _cprops.py, line 204 from:
value_size = len(value_bytes) * _ctypedefs.char.BYTES
to:
value_size = len(value_bytes) * _ctypedefs.char.BYTES + 1

And that solved the problem. I was able to set the start trigger.

  • OS: Windows 10.0.19044
  • Python version: 3.9
  • NI-XNET version: 2023 Q4

Installed packages and version

Package Version
blosc2 2.2.9
contourpy 1.1.1
cycler 0.12.1
deprecation 2.1.0
et-xmlfile 1.1.0
fonttools 4.43.1
importlib-resources 6.1.0
kiwisolver 1.4.5
matplotlib 3.8.0
msgpack 1.0.7
ndindex 1.7
nidaqmx 0.8.0
nixnet 0.3.2
npTDMS 1.7.1
numexpr 2.8.7
numpy 1.26.1
openpyxl 3.1.2
packaging 23.2
pandas 2.1.2
Pillow 10.1.0
pip 22.3.1
py-cpuinfo 9.0.0
pyparsing 3.1.1
python-dateutil 2.8.2
pytz 2023.3.post1
scipy 1.11.3
setuptools 65.5.1
six 1.16.0
tables 3.9.1
tzdata 2023.3
wheel 0.38.4
zipp 3.17.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions