LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Occasional Nugget 05/18/2007

Reading Jim's post about loop debugging on this LAVA thread reminded me of a similar trick I do with Event Structures.  In my event-based UIs, I always wire the iteration count of the While Loop containing my Event Structure through to the inner border of the Event Structure, like so:

I also deselect the "Use Default if Unwired" option on the output tunnel...that way when I create a new Event case, the VI will be broken, reminding me that I need to wire the iteration wire through on the new case:

Now, the reason I do this little trick is to help when debugging the execution order of events for my event structure.  In my current project, I've got mouse events firing all over the place...Mouse Move, Mouse Enter, Mouse Leave, Mouse Down, Mouse Up, Shortcut Menu Activation, etc.  Sometimes I really need to know the order in which certain events executed...to do this, I can probe these iteration wires within the event cases that interest me, and by comparing the values of the iteration counts, I can easily determine which events fired first.  If the events are firing multiple times and I want a history of their firing order, I can use my home-grown History Probes (see my previous Nugget on this topic).

-D

P.S. - Check out past nuggets here.

Message Edited by Darren on 05-18-2007 10:41 AM

Download All
Message 1 of 6
(8,496 Views)

Darren:

Interesting thought. This would be a very quick and easy way to debug without having to make any real changes to exisiting code and while running in the IDE.

I typically will just log the events to a text file with a quick drop in VI. The VI takes a string input. I pass the subVI the event info including arguments sent as well as what event. Tends to give me more information that I can review after running the code as an Executable. Upon completing debugging I remove the VI from the code. Tedius, sure, but allows me to run the Exe and I still clean up after myself.

0 Kudos
Message 2 of 6
(8,476 Views)
Amazing!
your nugget comes in the right time...i was having the exact problem of events firing in wrong order. with the iteration index, debugging was real fast Smiley Happy
 
Thanks Darren !
-----------------------------------------------------------------------------------------------------
... And here's where I keep assorted lengths of wires...
0 Kudos
Message 3 of 6
(8,327 Views)

I tried to do it using scripting for an existing application I had to work on which uses an event structure state machine. Unfortunately, the ES does not expose that information (and I would probably have to poll anyway).

Your solution is too simplistic for my use case (although I used a similar approach in some specific cases), but maybe I could have used the subVI approach (either by providing it with the event data or by using some more scripting if enough is exposed) and I may still need to, so thanks for the idea.


___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(8,319 Views)

Ah - logging. That's always a nice topic ;).

I always use a simple selfmade library. So I can get rid of breakpoints (most of the time) and still can "debug" code when it is built as an exe.

Here you can find the library and have a look at it.

http://forums.ni.com/ni/board/message?board.id=170&message.id=199742&query.id=144862#M199742

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 5 of 6
(8,141 Views)

Great Thought! And I think the trick can also be used widely to determine the order of state machine and so on.

Thanks!

Message 6 of 6
(7,374 Views)