Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to reset a CompactDAQ chassis through software?

Currently I must reset my SCXI modules so I don't get bad data on the next program cycle, but I am having big issues with my USB compact DAQ chassis lately.  I have to reset the chassis or all channels return zero values.  How can I reset a device like cDAQ1 in VB.NET like I can reset the chassis in Max?

 

Thanks.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 1 of 12
(5,692 Views)

Hi Michael,

 

This article describes resetting and self testing a device programatically. I think what you're looking for is

 

int32 DAQmxResetDevice (const char deviceName[])

 

 

I hope this helps,

 

Regards,

Luke B.

0 Kudos
Message 2 of 12
(5,681 Views)

Is that the same function call I am using?  I've shown the code below, but it throws and error if I try to reset a CompactDAQ device.

 

        Dim devices() As String = DaqSystem.Local.Devices
        Dim tempstring As String = ""

        'Array.Sort(devices)

        Try
            For Each tempstring In devices
                'MsgBox(tempstring)
                If Not tempstring.Contains("cDAQ") Then 'And (Not tempstring.Contains("Mod"))
                    dvc = DaqSystem.Local.LoadDevice(tempstring)
                    dvc.Reset()
                    frmD.txtMessage.AppendText(vbNewLine & dvc.ToString & " reset.")
                Else

                End If
            Next
        Catch ex As Exception

 

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 3 of 12
(5,669 Views)

Hi Michael,

 

From your code, it looks like you're trying to reset everything that isn't a cDAQ, is that right?

 

You might try calling a specific device like this: DaqSystem.Local.LoadDevice("cDAQ1").Reset()

 

Are you able to reset any other devices without the error? Does it give an error number?

 

Regards,

 

Luke B.

0 Kudos
Message 4 of 12
(5,660 Views)

Did you guys change something in the drivers regarding this?  It used to throw an error so I wrote out cDAQ devices.  Now the same code does not throw an error.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 5 of 12
(5,652 Views)

Hi Michael,

 

Did you install a new driver? That's the only way something would have changed. I'd guess that there was a typo, etc. that you caught somewhere along the line.

 

I'm glad to hear it's working now!

 

Regards,

 

Luke B.

0 Kudos
Message 6 of 12
(5,642 Views)

Seems that the issue doesn't follow a particular device.  Sometimes a device resets, sometimes it doesn't.

 

09:49:41    ResetDevices
NationalInstruments.DAQmx.DaqException: The specified device is not present or is not active in the system. The device may not be installed on this system, may have been unplugged, or may not be installed correctly.

Device:  cDAQ1Mod4

Status Code: -88705
   at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.CheckWithName(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
   at NationalInstruments.DAQmx.Device.Reset()
   at DEER_DAQ.modFunctions.ResetDevices()


09:51:14    ResetDevices
NationalInstruments.DAQmx.DaqException: Device identifier is invalid.

Device Specified: cDAQ1Mod3
Valid Values: cDAQ1, cDAQ2, cDAQ1Mod1, cDAQ1Mod2, Dev1, Dev2, Dev3

Status Code: -200220
   at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.CheckWithName(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* , tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* pName)
   at nNIMSSAIL100.StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >.Check(StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* )
   at nNIMSSAIL100.ThrowIfDeviceDoesNotExist<class nNIMSSAIL100::ApiTraits<class nNIMSSAIL100::DotNetApi> >(tCaseInsensitiveBasicString<unsigned short\,_STL::char_traits<unsigned short>\,_STL::allocator<unsigned short>\,nNIDMXS100::tLocaleConsideringWideStringComparitor\,nNIDMXS100::tLocaleConsideringWideStringCaseForcer>* strName, StatusObserverT<nNIMSSAIL100::ApiTraits<nNIMSSAIL100::DotNetApi> >* status)
   at NationalInstruments.DAQmx.DaqSystem.LoadDevice(String deviceName)
   at DEER_DAQ.modFunctions.ResetDevices()

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 7 of 12
(5,637 Views)

Hi Michael,

 

Is there a pattern to when it resets successfully/fails? Is it if you try and reset immediately after reseting another module? Is it usually after a crash or some other error?

 

Regards,

 

Luke B.

0 Kudos
Message 8 of 12
(5,626 Views)

I have this issue every single time I run in this particular machine.  I don't have the issue on other machines, but I have not tested it quite as much elsewhere either.

 

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 9 of 12
(5,624 Views)

I think I have fixed it.  I noticed that in MAX when you reset a chassis it takes a few seconds to refresh the modules.  I might have been trying to reset modules that had not been refreshed.  I only reset the chassis now and I put a 2 second sleep function in to allow for all modules to refresh before creating DAQmx tasks.  Seems to have worked...

 

Thanks.

Programming Data Acquisition and Control in Measurement Studio and Labwindows/CVI
0 Kudos
Message 10 of 12
(5,622 Views)