From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Independent Cursor Usage from the Current Plotting

Dear All,

 

In the program I've written, the signal is being read from a quad detector and simultaneously plotted. At the time being, the flexibility of my program is very low since the cursor activation is located right after the data reading code and thus, I must enter the cursor mode (i.e. the event structure by which I perform various action with the cursor has to be stopped in order to exit these two codes (reading and cursor activation) which are in a different main event structure).

Indeed, I want to remove the cursor activation event structure and put it in the outer event structure as an individual event. To do so, I need to save the data the detector is reading (XY data) in a local or global variable so I can pass to the cursor activation mode separately. I've already tried the latter option and realized that the program stops receiving any command by the user and the only solution is to kill the program!

I suspect that not directly sending the collected array of data into the cursor activating structure is the reason why the separated cursor event structure does not receive any command.

 

I would be greatly thankful for your helps in advance.

 

Kind Regards,

Arman 

0 Kudos
Message 1 of 5
(2,317 Views)

You need to show us some code.

0 Kudos
Message 2 of 5
(2,310 Views)

Sorry for the delay in replying.

 

I've attached the whole code.

The Event structure including both the reading and cursor manipulation is under the tabs Alignment --> Sample Positioning --> either Translational or Rotational tab. Please note that if you find either the Translational Scan or Rotational Scan buttons in the Block Diagram, it is connected to a case structure containing the processes mentioned in the previous sentence.

 

Many Thanks,

Arman

 

0 Kudos
Message 3 of 5
(2,262 Views)

Well, this needs to be redesigned from scratch. You have event structures inside while loops inside event structures. This is way too convoluted. An event structure always needs to be ready to fire (note that event structures queue up an infinite amount of events, even if they never get a chance to execute them because they are no reachable by dataflow because the code is trapped inside another loop).

 

I cannot really debug your code. My laptop screen resolution is not high enough to get an overview of the code. 😞

 

All you probably need is a simple state machine with an event based producer loop and a consumer loop to do the lifting. Use a parallel loop to handle UI interactions. Have a look at the design patterns.

0 Kudos
Message 4 of 5
(2,255 Views)

Thanks for your rapid response.

 

I wonder if I can somewhat save the reading output and use it to activate the cursor. By this, I mean, I remove the cursor activation event structure and replace it with few case structures instead where the latter are in the main event structure now. I am not sure If I can save the Graph XY and activate the cursor whenever I need it?

 

Many Thanks,

Arman

0 Kudos
Message 5 of 5
(2,249 Views)