07-04-2022 11:11 PM - edited 07-05-2022 12:08 AM
07-05-2022 12:40 AM
Hi yusung,
@yusung wrote:
How to call this USBHID.dll?
You can call that FirmwareReset executable using SysExec function in LabVIEW.
For the DLL you need to ask the provider of that DLL: SiliconLabs…
07-05-2022 10:45 PM
Excuse me, I tried to use the following command, why did it fail?
GetUSBDeviceSN(DWORD dwDeviceNum, const char ** psSerialNum);
07-06-2022 05:30 AM - edited 07-06-2022 05:40 AM
@yusung wrote:
Excuse me, I tried to use the following command, why did it fail?
GetUSBDeviceSN(DWORD dwDeviceNum, const char ** psSerialNum);
Because you try to call a C function without fully understanding C programming!
The Call Library Node gives you the ability to call such functions. It doesn't and can't make it as fool proof as calling LabVIEW functions.
Following errors are present in your code:
1) You tell LabVIEW that it is safe to pass that parameter without reevaluating it after the call because the function won't modify it (by checking the constant checkmark).
2) You pass in a fixed value 1 to the dwDeviceNum parameter. The description explicitly says that to address the first device you would have to pass in 0. Your device number 1 is only valid if you happen to have at least two debugger devices connected to your computer.
3) You assume wrongly that a LabVIEW string is the same as a C string pointer. It absolutely isn't! Therefore you can't just pass in an array of LabVIEW strings and magically hope that the function somehow will return some information. If you hadn't wired 1 to the dwDeviceNum, resulting in an invalid device index, the DLL would have overwritten the LabVIEW string handle entry by its own string pointer and on return LabVIEW would have tried to interpret that pointer as a string handle and crashed.
07-06-2022 07:44 AM
OMG! During study,I've read the third point several times, but I don't understand it very well.
I used the method you gave to successfully get what I want, but there is still an error out, is this normal?
07-06-2022 08:44 AM
No it isn't, but since you obviously didn't use the VI I attached (mine has a dwDeviceNum input), and failed to attach yours, I can't know what might be the problem.
07-06-2022 08:23 PM - edited 07-06-2022 08:28 PM
Have, but the previous paragraph is missing.
I'm doing project burn-in, it's just that I don't know C very well.
There may be many more questions.
07-07-2022 12:06 AM
hi rolfk ,I found the error code 1097 problem and solved it, but I keep doing it and the problem occurs again, can you help?
07-07-2022 01:25 AM
Which function gives you that error?
It's hard to guess and I can't run the VIs on my computer as I do not have that hardware available. From a Quick glance the VIs seem to be configured properly. Sorry about the calling convention mistake for the LabVIEW LStrPrintf() call. It was a quick and dirty copy paste mistake.
My guess is, that the DLL might try to load the (or another) secondary DLL to implement the actual connection for the USB type and unless it does some rather unusual path calculations of its own to build the correct path to the secondary DLL relative to its own location, it must fail since Windows will not find that DLL in the same folder as the main DLL that you load with LabVIEW.
07-07-2022 01:28 AM
Seems to work, but Connected vi looks weird. can help, thanks