Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post your LabVIEW discussions here
Post Reply
wgeithner
Newbie
Posts: 0
Joined: Thu Nov 10, 2022 4:35 pm

Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by wgeithner »

Hi,

I found already a couple of threads about error 1097, but none of those helped in my case.

I am programming in LabVIEW 2021 SP1 (32 bit) under Windows10.

I have a PicoScope 3406DMSO connected to a USB 2.0 port (3.0 port is not available at my computer), downloaded and installed the PicoScope6 software, which connects to the scope without problems.

I downloaded as well the LabVIEW examples, the shared library and the SDK (32 bit).

As a first test, I ran PicoScope3000aOpen.vi from the examples. The VI runs without any problems.

As a "HelloWorld" example, I just call ps3000a.dll::ps3000aOpenUnit-2 and close the unit again by calling ps3000a.dll::ps3000aCloseUnit-2. The "open" command is executed without any issues, but the "close" call to the DLL throws error 1097. I checked the calls to the DLL ps3000a.dll (from PicoScope6 app directory) in the LabView code examples and it seems to be exactly the same what I do (methods called, population of interface variables and data types).

Currently, I simply suppress error 1097 in my LabVIEW code, but I am not sure if this is the right way. If error 1097 is thrown by the DLL, does that mean the code in there is executed properly? At least the CloseUnit command works even if it thorws 1097.

Martyn
Site Admin
Site Admin
Posts: 4501
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by Martyn »

You will need to pass the error code returned by OpenUnit into the ChangePowerSource call.
ChangePowerSource.png
Martyn
Technical Support Manager

wgeithner
Newbie
Posts: 0
Joined: Thu Nov 10, 2022 4:35 pm

Re: Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by wgeithner »

Thanks for the suggestion, but I do not call "ChangePowerSource". I only "OpenUnit" and immediately do a "CloseUnit".

Martyn
Site Admin
Site Admin
Posts: 4501
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by Martyn »

That is why you get the error, you need to call ChangePowerSource if the return from Open Unit is not OK. That function tells the driver that you know you are only connected to a USB2 port.
Martyn
Technical Support Manager

wgeithner
Newbie
Posts: 0
Joined: Thu Nov 10, 2022 4:35 pm

Re: Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by wgeithner »

As I wrote in my initial post "The "open" command is executed without any issues". Only the CloseUnit command throws 1097.

Martyn
Site Admin
Site Admin
Posts: 4501
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Error 1097 when calling 3000a.dll::ps3000aCloseUnit

Post by Martyn »

The return from OpenUnit is also 1097, it is just that it is an acceptable return code for the OpenUnit call and allows continued execution. If you call ChangePowerSource using this error code as an input, as we do in our examples, all following API calls will work correctly and the CloseUnit will return 0 (Status OK)
Martyn
Technical Support Manager

Post Reply