01-02-2020 12:23 AM
Dear All,
I have a DLL file and some functions (MIU Initial, MIU Write Register) in it is with struct type variable which is containing unsigned char, unsigned short, float, char type variables.
I need to get data from a INI file and pass into the DLL file function.
I can get the data from INI file, but I do not know how build the cluster for the struct.
Please help me.
typedef struct _MIUINITIALVALUE
{
unsigned char SensorMode;
unsigned short nWidth;
unsigned short nHeight;
unsigned char MCLKOnOff;
unsigned char MCLKSelection;
float MCLK;
unsigned char PCLKInversion;
unsigned char IICDeviceID;
unsigned char IICMode;
unsigned char IICSpeed;
unsigned char IICReadRestart;
unsigned char IICReadRestartInterval;
unsigned char IICSCKPinCheck;
unsigned char IICAddressLength;
unsigned char IICDataLength;
unsigned char MIPILaneEnable;
unsigned char MIPIDataType;
float MIUIOVoltage;
unsigned char FirstPowerChannel;
float FirstPowerVoltage;
unsigned char SecondPowerChannel;
float SecondPowerVoltage;
unsigned char ThirdPowerChannel;
float ThirdPowerVoltage;
unsigned char FourthPowerChannel;
float FourthPowerVoltage;
unsigned char FifthPowerChannel;
float FifthPowerVoltage;
unsigned char MIPI8bitMode;
float CPHYINCKMHz;
unsigned short CPHYDataRateMsps;
char MIPIPHY;
unsigned char Power5VoltOnOff;
}MIU_INITIALValue;
Solved! Go to Solution.
01-02-2020 12:46 AM
Hi amt,
@luxvisions.amt wrote:
I can get the data from INI file, but I do not know how build the cluster for the struct.
Why do you read the content of the INI file as "strings" when you expect numbers?
Your Initialize VI already contains that cluster, so why don't you know how to "build" that cluster?
Do you really need to unbundle the cluster before calling the initialize function of the DLL? That function expects a struct, but not a huge list of individual values…
01-06-2020 02:15 AM
Hi GerdW,
The initial VI is imported with shared library wizard, I don't think it can work properly,
so I need to build a cluster manually for that struct.
I will set the INI variables from string to numbers.
Thanks
01-07-2020 02:58 PM - edited 01-07-2020 02:59 PM
The Laon People API is pretty complex to interface to from LabVIEW. And the MUInitialize() function is especially complicated. This structure is passed by value which for LabVIEW means you can't pass a cluster to the DLL but have to split the cluster into 32 bit chunks to pass to the function as individual parameter values and also need to account for memory alignment. That makes it all pretty nasty!
I did a driver for the LPC500/600 device but can't post it as it is for company projects for a customer.
This is the relevant section for my driver for the Initialize function. It seems the same as yours up to after the fifth voltage parameter, then the things are different. Also note that this only is correct for 32-bit LabVIEW with 32-bit
driver. For 64-bit things would look fairly different again.
01-07-2020 07:55 PM - edited 01-07-2020 07:57 PM
Hi Rolf,
I will try to modify my code as yours.
Thanks a lot.