Set the I/O Voltage Level for the NI 8452 I2C/SPI Interface?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
In LabView there is a way to set the 8452's I/O Voltage Level to values between 3.3 and 1.2V. Is there a way to access this in MATLAB?
1 comentario
Respuestas (2)
John Hribar
el 20 de Oct. de 2019
4 comentarios
John Haven
el 20 de Nov. de 2019
Hi John,
Thank you very much. I'll give this a try and let you know if I have any issues. This saves me a lot of time!
Thanks again,
John
Nathan Monroe
el 15 de Jul. de 2020
Thanks John, for this wonderfully helpful resource. After a few frustrating days of fiddling with it, thought I'd add a few notes for future people who come upon this page.
In my 64 bit Windows system, the above loadlibrary command fails. I resolved this by editing the ni845x.h file in the above to add the following lines:
#include <stdio.h> // Include file for printf
#include <stdlib.h> // Include file for strtol
#include <conio.h> // Include file for _getch
#include <string.h>
#include <windows.h> // Include file for Win32 time functions
These were taken from one of NI's example scripts. It's possible not all of them are necessary, but it works. On top of that, there seems to be some issue where Matlab compiles the code for a 32 bit system when really my system is 64 bit. As a result, there is a datatype error with the DeviceHandle, relating to 32 bit vs 64 bit unsigned integers. To resolve this, I added to the ni845x.h file the following:
#define WIN64
I admittedly don't fully understand the nuances of it, but this resolves my issues and allows John's above code to work.
Andrei
el 12 de Sept. de 2023
Starting in MATLAB R2023a, this is possible by using the new ni845x interface, which has a VoltageLevel property
0 comentarios
Ver también
Categorías
Más información sobre Call C from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!