04-25-2007 04:50 PM
04-26-2007 11:01 AM
07-10-2009 01:09 PM
Hi Jonathan,
I am not sure you are still available since the post was two years old. I had a problem to use AxCWDAQControlsLib with CWCounter. I have error when I called Configure() function as below:
System.Runtime.InteropServices.COMException was unhandled
ErrorCode=-2146817829
HelpLink="cwdaq.chm#500"
Message="Configuring channels The NI-DAQ DLL could not be called due to an interface error."
Source="cwdaq"
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at CWDAQControlsLib._DCWCounter.Configure() at AxCWDAQControlsLib.AxCWCounter.Configure() at USB6501App.Form1.statusButton_Click(Object sender, EventArgs e) in D:\Fisheye_Project_2008\USB6501App\USB6501App\Form1.vb:line 71 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m) at System.Windows.Forms.Control.WmCommand(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.NativeWindow.DefWndProc(Message& m) at System.Windows.Forms.Control.DefWndProc(Message& m) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at USB6501App.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:
_____________________
Could you help me what is the problem?. I tried the MAX test panel and VB6 application to test the counter. They work fine. Some how the interop.service call not access this COM.
Thanks for your help.
Tu
07-13-2009 02:44 PM
tnguyen,
What version of Traditional NI-DAQ do you have installed on your computer? You can check in Measurement and Automation Explorer under the Software section. Are you using the NI-DAQmx test panels or the Traditional NI-DAQ test panels?
07-14-2009 09:28 AM
Hi Erric,
Thanks for your response. I am using the measurement studio 8.6 and 6 (support VB6). I installed the latest Traditional NI-DAQ driver 7.4.4. I am converting my old application from VB6 to VB .Net. I am trying to use the CWCounter activex within windows form. I added the icon CWCounter from toolbox in order the visual studio created the wrapper. However, in the code, when I called the function configure. It came the error as I posted. I also tried to fix as Document ID: 2Q1HG8A6 but it wasn't successfully.
I also tried to call API functions from dotnet but it always give error that "nidaq32.dll could not loaded due to initialize failed" even I copied the file in the same folder of program.
I have found that I have to create the wrapper VB6 activex to access the API functions to the generic counter for my dotnet application. It works perfectly.
For your answer, I have two counters: DAQAI16XE50 (PCMIA) and USB6501 (USB). I am not familiar with USB6501 due to the new NI-DAQmx develop. But I almost figured out how to make USB 6501 work as simple event counter with start, stop, reset and count. However, I still don't know how to detect the overflow when it counts like the one DAQAI16XE50 did.
I attached some captured images for your reference.
Thanks again for your support,
Tu Nguyen
07-16-2009 10:37 AM
Tu,
So is your only question on how to get your USB-6501 to detect overflow using the NI-DAQmx driver? I wouldn't recommend mixing the Traditional DAQ driver and the NI-DAQmx driver in one program, unless you are using the Traditional DAQ driver to access one card and the NI-DAQmx driver to access your other card. Did this example work before you tried to modify it?