Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Session.stop from handler

Subject: Session.stop from handler

From: Jarek Luberek

Date: 5 Feb, 2013 08:44:09

Message: 1 of 1

I'm trying to stop a data acquisition session started with s.startBackground from the listener.
The listener, which is a method of an object (which is < handle), looks at the data and decides when it's enough and calls stop(). The main process does a wait().
This almost works in the sense that the correct data are sampled and it stops at the right moment but there is a warning/error:

Warning: Error occurred while executing callback:
Error using daq.internal.StateReadyToStartAndPrepared/processHardwareTrigger (line 223)
Internal Error: Unexpected operation processHardwareTrigger occurred in state ReadyToStartAndPrepared.
> In Channel>Channel.onDataReceived at 370
  In Channel>@(source,data)obj.onDataReceived() at 295
  In Session>Session.doWait at 2365
  In StateHardwareRunning>StateHardwareRunning.wait at 75
  In Session>Session.wait at 717
  In test at 47

The docs suggest that one should be able to stop from within a handler but obviously I'm not doing it correctly.

If I let the callback set a variable in object and then poll this variable in the main program, I can make this work but it seems like the wrong way to do it.

/jarek

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us