LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital input problem

Hi,

 

I'm new using labview, i'm building a VI to play video using Windows Media Player ActiveX and NI 9426 digital I/O. Attached VI is what i've try so far but there's a problem which i'm still can't find the solution. On the attached VI i've replace the digital task using boolean array, i use switch button (not latch/push button) because this is to simulate the real condition since the NI 9426 is connected to an output from plc which is not latch. 

 

Now the VI wont play the video on the first trigger from digital IO, it will play on second trigger, I mean when the VI run and one of the digital IO is activated no video is playing and when i activate another IO the video is playing. What i want try to achieve is before play any video VI will only display welcome image using picture ring and the when there's a trigger from digital IO it will hide the welcome image and play the video. Each IO trigger different video..

 

How can i achieve this?

 

Thank you

0 Kudos
Message 1 of 6
(2,778 Views)

Hello Ijan,

 

Thank you for posting on the forums! After looking through your code, there are a few things that I would recommend implementing.

 

First of all, when you have a zero constant wired in to the Timeout terminal of an event structure, that structure is in a perpetual state of timing-out. This can make a VI unstable and hard to predict.

 

timeout.PNG

 

To demonstrate this concept, please look at the attached “TestEventStructure.vi”- which displays the number of times a similarly-timed event structure executes.

 

Also, I recommend wiring the outputs of your Index Array function directly to the Boolean indicators, as the indicators are not being connected directly elsewhere.

 

Let me know how it goes!

Cameron
0 Kudos
Message 2 of 6
(2,686 Views)

Hi FrisbeeArrays,

 

Thank you for your advice...i try to connect the index array directly to boolean indicator but the event become not working. 

I also have a problem with picture ring, i use visible property node to make the picture visible when VI run and hide it when video is playing. Now when i run my VI the picture is hiden/not visible. looks like the property node inside event structure is already trigger.

 

attached is my vi

 

 

0 Kudos
Message 3 of 6
(2,662 Views)

Hello Ijan,

 

It was a great idea to disable the DAQ components of your code using a Diagram Disable structure to allow for deeper testing of the rest of your VI.

 

As you input loop iterates every hundred milliseconds, I highly recommend setting your Event Structure Timeout value to several hundred milliseconds. Currently, your loop times out every millisecond, which can force it to miss the events it is trying to detect.

 

Would you mind increasing your Event Structure Timeout value? Also, have you been able to independently verify the functionality of the code that executes for each event?

Cameron
0 Kudos
Message 4 of 6
(2,630 Views)

Hi Frisbee,

 

Each event has the same code the only difference is the index array which is used to select path of video file to be played. Corcerning the visible property node of picture ring, i've decide to remove it and change with a video. What i'm struggling for is the value signaling constantly triggering the event. I've read the forum there are some solution for this but none is working maybe due to the value signaling is come from daqmx task not a boolean control. 

How to properly use value signaling which come from daqmx task to trigger an event? 

0 Kudos
Message 5 of 6
(2,604 Views)

Hello Ijan,

 

Are you interested in converting a numeric value to a Boolean and then triggering an event based on that Boolean’s value change? If so, I highly recommend using a comparison function (such as greater than or less than) to compare your signal to a known value and determine a true/false value accordingly. In this way, you could output your trigger signal when your acquired signal surpasses a particular value.

 

If you are interested in having a Boolean indicator trigger an event structure, I highly recommend looking through the VI that altenbach posted on the following forum thread:

 

http://forums.ni.com/t5/LabVIEW/How-do-i-get-a-boolean-indicator-to-trigger-a-event-structure/m-p/14...

Cameron
0 Kudos
Message 6 of 6
(2,564 Views)