Help using NI-845x SPI and DIO in MatLab
Mostrar comentarios más antiguos
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
el 10 de Feb. de 2025
spi_obj = spi('ni845x', 0, 0);
7 comentarios
Erik
el 11 de Feb. de 2025
Walter Roberson
el 11 de Feb. de 2025
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
el 11 de Feb. de 2025
Walter Roberson
el 11 de Feb. de 2025
'NI box serial' has to be the serial number of the device.
If you only have one ni845x then
device = ni845x();
Erik
el 11 de Feb. de 2025
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
el 11 de Feb. de 2025
Categorías
Más información sobre Test and Measurement en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!