private void InitUL() { MccDaq.ErrorInfo ULStat; // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop clsErrorDefs.ReportError = MccDaq.ErrorReporting.PrintAll; clsErrorDefs.HandleError = MccDaq.ErrorHandling.DontStop; ULStat = MccDaq.MccService.ErrHandling (clsErrorDefs.ReportError, clsErrorDefs.HandleError); //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); }
public frmEventDisplay() { // // Required for Windows Form Designer support // InitializeComponent(); // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); // Allocate buffer to hold data... hBuffer = MccDaq.MccService.WinBufAlloc(TotalCount); if (hBuffer == 0) { throw(new OutOfMemoryException("Insufficient memory.")); } //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); _ptrOnScanError = new MccDaq.EventCallback(OnScanError); }
public frmEventDisplay() { // // Required for Windows Form Designer support // InitializeComponent(); // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); //configure the digital port for input ULStat = DaqBoard.DConfigPort(this._digPort, MccDaq.DigitalPortDirection.DigitalIn); //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); }
public frmEventDisplay() { // // Required for Windows Form Designer support // InitializeComponent(); // Put references to data labels into arrays for // easier access using indices. lblPostTriggerData = new Label[10]; lblPostTriggerData.SetValue(_lblPosttriggerData_9, 9); lblPostTriggerData.SetValue(_lblPosttriggerData_8, 8); lblPostTriggerData.SetValue(_lblPosttriggerData_7, 7); lblPostTriggerData.SetValue(_lblPosttriggerData_6, 6); lblPostTriggerData.SetValue(_lblPosttriggerData_5, 5); lblPostTriggerData.SetValue(_lblPosttriggerData_4, 4); lblPostTriggerData.SetValue(_lblPosttriggerData_3, 3); lblPostTriggerData.SetValue(_lblPosttriggerData_2, 2); lblPostTriggerData.SetValue(_lblPosttriggerData_1, 1); lblPostTriggerData.SetValue(_lblPosttriggerData_0, 0); lblPreTriggerData = new Label[10]; lblPreTriggerData.SetValue(_lblPretriggerData_9, 9); lblPreTriggerData.SetValue(_lblPretriggerData_8, 8); lblPreTriggerData.SetValue(_lblPretriggerData_7, 7); lblPreTriggerData.SetValue(_lblPretriggerData_6, 6); lblPreTriggerData.SetValue(_lblPretriggerData_5, 5); lblPreTriggerData.SetValue(_lblPretriggerData_4, 4); lblPreTriggerData.SetValue(_lblPretriggerData_3, 3); lblPreTriggerData.SetValue(_lblPretriggerData_2, 2); lblPreTriggerData.SetValue(_lblPretriggerData_1, 1); lblPreTriggerData.SetValue(_lblPretriggerData_0, 0); // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); // Allocate buffer to hold data... hBuffer = MccDaq.MccService.WinBufAlloc(BufferSize); //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); _ptrOnScanError = new MccDaq.EventCallback(OnScanError); }
public frmEventDisplay() { // // Required for Windows Form Designer support // InitializeComponent(); // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); //configure the digital port for input ULStat =DaqBoard.DConfigPort(this._digPort, MccDaq.DigitalPortDirection.DigitalIn); //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); }
public frmEventDisplay() { // // Required for Windows Form Designer support // InitializeComponent(); // Initiate error handling // activating error handling will trap errors like // bad channel numbers and non-configured conditions. // Parameters: // MccDaq.ErrorReporting.PrintAll :all warnings and errors encountered will be printed // MccDaq.ErrorHandling.StopAll :if an error is encountered, the program will stop MccDaq.ErrorInfo ULStat = MccDaq.MccService.ErrHandling(MccDaq.ErrorReporting.PrintAll, MccDaq.ErrorHandling.StopAll); // Allocate buffer to hold data... hBuffer = MccDaq.MccService.WinBufAlloc(TotalCount); if (hBuffer==0) throw(new OutOfMemoryException("Insufficient memory.")); //store a reference to this instance in the TUserData struct _userData.ThisObj = this; //get a pointer to the TUserData struct to pass to EnableEvent _ptrUserData = Marshal.AllocCoTaskMem(Marshal.SizeOf(_userData)); Marshal.StructureToPtr(_userData, _ptrUserData, false); //get pointers to the event handlers to be called... _ptrMyCallback = new MccDaq.EventCallback(MyCallback); _ptrOnScanError = new MccDaq.EventCallback(OnScanError); }