Help using NI-845x SPI and DIO in MatLab

I am trying use the SPI interface as well as control the DIO pins. So far I have to connect to the NI box 2 seperate ways to make it work. I found an example that supposedly does this but it doesn't work.
device = ni845x('NI box serial');
spi_obj = spi(device, 0, 0);
I get the following error regarding the vendor???
Error using spi
Expected input number 1, vendorName, to match one of these values:
'aardvark', 'ni845x'
The input did not match any of the valid values.
Error in stest (line 17)
spi_obj = spi(device, 0, 0)

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Feb. de 2025
spi_obj = spi('ni845x', 0, 0);

7 comentarios

Erik
Erik el 11 de Feb. de 2025
I can connect that way but then I dont have access to the DIO pins, only the SPI pins
Well, it is currently not supported to call spi() given a ni845x() device.
Consider the possibility of using
spi_obj = spi('ni845x', 0, 0);
connect(spi_obj);
device = ni845x('NI box serial');
configureDigitalPin(device,"P0.0","input");
num_values = 4;
value1 = read(spi_obj, num_values);
value2 = readDigitalPin(controller,"P0.0");
Erik
Erik el 11 de Feb. de 2025
i get this error on line 3 (device = ni845x('NI box serial'))
Failed to create controller object. Unable to find controller with specified serial number or specified serial number is invalid.
'NI box serial' has to be the serial number of the device.
If you only have one ni845x then
device = ni845x();
Erik
Erik el 11 de Feb. de 2025
this what I got before
Failed to create controller object. Connection to controller with the specified serial number already exists.
Walter Roberson
Walter Roberson el 11 de Feb. de 2025
It just might be the case that you can either establish an spi connection or a DIO connection. I do not know. I do not have any ni845x to experiment with.
I can say that spi() has no option to accept a device returned from ni845x()
I suggest that you open a support case.
Erik
Erik el 11 de Feb. de 2025
Thats what I kinda thought. Thanks for you time

Iniciar sesión para comentar.

Categorías

Más información sobre Test and Measurement en Centro de ayuda y File Exchange.

Productos

Versión

R2023a

Preguntada:

el 10 de Feb. de 2025

Comentada:

el 11 de Feb. de 2025

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by