Test and Measurement Forum

USB ADC11 / VC++

Post your C and C++ discussions here

USB ADC11 / VC++

Postby bennnun » Mon Jun 01, 2009 1:02 am

Hello,
I am having some problems with my program.
It is only connecting to the ADC11 and disconnecting.
The problem is when I connect, disconnect and then try to reconnect, the program get stuck in the function UsbAdc11OpenUnit(). If I close my program, then it is remaining in the task manager with a 50% CPU's load (same problem with PicoLog or the excel macro).
In order to stop the program or the excel macro, I have to unplug the ADC11.
It seems that PicoLog (R 5.20.3) doesn't have the reconnection problem but the excel macro shows the same behaviour as my program.

I used the example that was in "USBADC11CON.C".
Here is my code :

Code: Select all
MyButtonConnectionFunction
{
    m_handle = UsbAdc11OpenUnit();

   if (!m_handle)
   {
      char line[80];
      UsbAdc11GetUnitInfo(m_handle, line, sizeof(line), 0);
      // LOG
   }
   else
   {
      for (unsigned short i = 0 ; i < 4 ; i++)
      {
         char line[80];
         UsbAdc11GetUnitInfo(m_handle, line, sizeof(line), i);
         // LOG
      }
   }
}

MyButtonDisconnectionFunction
{
if (UsbAdc11CloseUnit(m_handle))
   // LOG
}


My PC is XP SP2, dual-core T7700.
I use VS 2008 (.NET 3.5).
Do you know about those problems ? I would be really interested in some documentation on the USB API since I have only one code example.
Best regards.
bennnun
User
User
 
Posts: 3
Joined: Fri May 29, 2009 8:48 am

Postby bennnun » Mon Jun 01, 2009 5:57 am

Hello again,
It seems I am really lucky on this one.
I made many try to get this problem solved and I found out that calling UsbAdc11Stop(void) before UsbAdc11CloseUnit(short handle) corrects the connection problem.
Also when connected I don't have anymore the annoying 50% CPU's load.
I think UsbAdc11Stop(void) is used to stop an acquisition (not sure without documentation) as adc11_stop(void) is doing on the parallel version but why do I have to stop an acquisition that I never started ? Are there any requests exchanged after opening the unit that would need to be cleaned before closing the connection ?
Best regards.
bennnun
User
User
 
Posts: 3
Joined: Fri May 29, 2009 8:48 am

Postby Robin » Tue Jun 02, 2009 10:10 am

Hi

It shouldn't be necessary to call the stop function before closing the unit. We have modified the DLL to correct this. Thanks for spotting this.

Robin
Attachments
usbadc11.zip
(101.63 KiB) Downloaded 179 times
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Postby bennnun » Wed Jun 03, 2009 5:08 am

Hi
Thanks for the fast reply !
It works really well now.
Best regards.
bennnun
User
User
 
Posts: 3
Joined: Fri May 29, 2009 8:48 am


Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests