Issue with mexNI845x Not Finding Resource Names Properly
조회 수: 5 (최근 30일)
이전 댓글 표시
I am attempting to utilize a NI-8452 to be a SPI master that will communicate with a test board. Matlab code eventually makes use of NI845xSPILib.m
Tracing through the issue, I found that the problem lies with mexNI845x('findDevices') not returning the proper resource name. On my system it simply returns 'ni845x'. On my coworkers system, it returns USB0::0x3923::0x7514::01BE1159::RAW. Code that exists in the Utility.m file, attempt to parse this resource name and split it based on '::' however, the string being based to it does not contain any '::' and therefore it causes failures.
On my coworkers system, everything runs as expected with no problems he is using (Matlab 2017b) On my system, running a command like instrhwinfo('spi') causes it to hit the line of code mentioned earlier and crash. (I am using Matlab 2018a)
댓글 수: 0
답변 (1개)
Han Du
2018년 5월 4일
Make sure the support package is installed. The NI-USB-8452 is supported via a support package, per: https://www.mathworks.com/hardware-support/spi-interface.html
See at the bottom of the page for the support package link.
Here's an example of using the support package:
Unfortunately it doesn't look like the device can be simulated in NI MAX so I cannot try to reproduce the issue in R2018a. I wouldn't expecting running instrhwinfo('spi') to check for devices. It only returns the supported vendors and installed vendors:
>> i2cInfo = instrhwinfo ('spi')
i2cInfo =
HardwareInfo with properties:
SupportedVendors: {'aardvark' 'ni845x'}
InstalledVendors: {'ni845x'}
I would expect instrhwinfo('spi', 'ni845x') to check for devices:
>> i2cInfo = instrhwinfo ('spi', 'ni845x')
i2cInfo =
HardwareInfo with properties:
VendorName: 'ni845x'
VendorDescription: 'National Instruments'
VendorLibraryName: 'Ni845x.dll'
InstalledBoardIds: {1×0 cell}
BoardSerialNumbers: {1×0 cell}
ObjectConstructors: {1×0 cell}
댓글 수: 2
Han Du
2018년 5월 4일
From the code, it seems that the function is not doing much other than calling the underlying ni845x.h provided by National Instruments to get the resource names for each device. What is the resource name showing in your NI MAX?
참고 항목
카테고리
Help Center 및 File Exchange에서 Instrument Control Toolbox Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!