How to check if the biosemi is not switched on?

Post Reply
maarcc2050
Posts: 27
Joined: Sun Jan 17, 2010 1:23 pm
Location: Brisbane

How to check if the biosemi is not switched on?

Post by maarcc2050 »

Hi.

In my program, I need to check if biosemi is switched off. What should be the return value if it is not turned on? My codes did a USB_WRITE(handle, usbdata). But that doesnt seem to be the correct way to do it as it always return 0 regardless if biosemi is switched on/off.

Thanks.

Coen
Site Admin
Posts: 1124
Joined: Fri Mar 26, 2004 7:00 pm
Location: Amsterdam, Netherlands
Contact:

Post by Coen »

Check the file pointer of the ringbuffer, if it remains a constant value, then no data is coming in.

Best regards, Coen (BioSemi)

pmac
Posts: 70
Joined: Thu Jan 21, 2010 2:51 pm
Location: Canada

Post by pmac »

Hi Maarcc,

Also, from the answer to another problem:

"When the acquisition is running READ_POINTER returns TRUE and when it's not running it returns FALSE."

To illustrate, in January 2010 Labview_DLL_Synctest.cpp was changed to test this returned value.

Paul

michaelrepucci
Posts: 13
Joined: Thu Aug 11, 2011 9:44 pm
Location: NYC

Post by michaelrepucci »

I'm having this same problem, and the value returned from READ_POINTER does not seem to indicate whether acquisition is running, since it always returns true.

Instead I get some output to the command line that says:

GetOverlappedResult for buffer 0 returns 121
The semaphore timeout period has expired.

This isn't particularly useful for alerting the user, and can't be caught, as far as I can tell. And the alternative - to check whether the read pointer is actually changing - is less than ideal, since if the function is called too closely together, the read pointer won't have changed even with the device on.

michaelrepucci
Posts: 13
Joined: Thu Aug 11, 2011 9:44 pm
Location: NYC

Post by michaelrepucci »

In fact, in my tests, I've found that all of the functions described http://www.biosemi.com/faq/make_own_acq ... ftware.htm always return true, regardless of whether the device is on/off or connected properly.

pmac
Posts: 70
Joined: Thu Jan 21, 2010 2:51 pm
Location: Canada

Post by pmac »

Hi Michael,

Try this:

Open a command prompt window and cd to the directory where you unzipped the BioSemi driver download package.

Then cd to USB_drivers_Windows_32bit (or 64bit), Developers_kit, C-code.

Run this: Labview_DLL_SyncTest 5

This will run for 5 seconds. Hit any key to exit.

Now power the BioSemi receiver off and run the command again.
Here's what I get:

ring buffer size = 33554432
GetOverlappedResult for buffer 0 returns 121
The semaphore timeout period has expired.

READ_POINTER returns FALSE -> acquisition not running!
stopping ...
Aborted, hit a key to exit


The source code for this program is in the same directory.

I downloaded both the 32 and 64 bit packages today and both give the same result.

Regards,
Paul

michaelrepucci
Posts: 13
Joined: Thu Aug 11, 2011 9:44 pm
Location: NYC

Post by michaelrepucci »

When I run that application, I do get the same results. To be specific, since this is important for the discussion and solution below, I'm talking about the application to which you referred, but obtained from a "USB driver Windows (64bit)" download I made on August 3, 2011. Please be aware that this is NOT the same download that is currently available. (I have the old and current downloads saved if you would like them.) This package must have been updated by BioSemi in the interim.

Since my application did not exhibit this behavior, I poked around and discovered the source of the difference. I'm running Windows XP x64, but compiling a 32-bit application. I had been dynamically loading the Labview_DLL.dll that was contained in the ActiView Beta 7.0 package (http://www.biosemi.com/download/LatestA ... 0-Vari.zip), since I'd installed and successfully used that program on my computer. WARNING: The READ_POINTER function in this particular version of the Labview_DLL.dll always returns TRUE!

However, I found that if I use the Labview_DLL.dll contained in the "USB driver Windows (32bit)" package (http://www.biosemi.com/download/USB%20d ... 032bit.zip), I do get the same behavior, specifically READ_POINTER returns FALSE when the device is off. (The other methods, OPEN_DRIVER_ASYNC, USB_WRITE, READ_MULTIPLE_SWEEPS, and CLOSE_DRIVER_ASYNC, all return the same values whether the device is on or off.)

FYI, the Labview_DLL.dll files contained in the 64bit packages (either old or current) will not work, of course, since my application is 32-bit. The Windows API function LoadLibrary cannot obtain a handle to a 64-bit DLL from a 32-bit app.

pmac
Posts: 70
Joined: Thu Jan 21, 2010 2:51 pm
Location: Canada

Post by pmac »

Hi Michael,

This TRUE/FALSE from READ_POINTER was fixed in Jan 2010 so any Labview_DLL.dll created after date that should be OK.

The dll file packaged with Actiview must be from before that date. I will bring this to Coen's attention.

As you have discovered, you must download and install the driver package that matches your system - 64 or 32 bits.
This is in order to get the correct version of the MS kernel mode driver WinUsb installed.

However when running a user mode program, the version of Labview_DLL.dll used must match that which the application program
uses - 64 or 32 bits.

Regards,
Paul

Post Reply