Triggering an event with a digital input

Hello all,
I'm writing my first Labview program.  I used an architecture I found on the forums here, and it has been very helpful in getting me started.  This architecture uses two while loops, one containing an event structure and one containing a case structure.  (This is a queued state machine architecture, I believe).
Part way through the programming, we decided we needed a sensor to make sure the part was in the test fixture during the test.  If the part is removed during the test, we'd like to safely stop the test.  So basically, I need to monitor a digital input (on an NI-USB-6525 module) and enter the "Stop" case if the digital input turns off.  I would also like to make sure this digital input is on before entering the "Start" case.  I don't care if the input changes state when the test is not running, nor do I care about its state during the "Exit" case.
I'm really not sure how to add this functionality to my "stop" case.  I don't even know if it's possible.  I've been researching DAQmx events, but I haven't found an example or answer that aligns with my particular problem. 
I've attached my code.  It's incomplete right now - I still have a large number of steps to add.  I wanted to get this issue figured out before I programmed any more steps.  A preview of the code showing the basic architecture is shown in the picture below.
Does anyone have any ideas or suggestions for me, or questions if my problem is unclear?  Also, if you see anything else in my code that will be problematic, please let me know.
Thanks in advance!
Attachments:
Main_Loop_072412.vi ‏195 KB

I should also add that I looked into event dynamic registration, but it seemed incompatible with my issue.  I don't want my top loop to run only when an event triggers it - I want it to run all the time so that it can immediately respond to button presses. Also, most of the triggering I found was based on value change.  I care about the actual value, not just that it changed.
I don't want to do anything that will bog the code down too much since it is important that the system respond immediately to inputs, especially to the stop or exit button presses.
I'm sure I am missing something very basic here.  I'm used to ladder logic, where everything is simple and straightforward. 

Similar Messages

  • Huge Core Audio issue with Optical digital input (S/PDIF) on MacPro

    Hello to all,
    I just realized that it's just impossible to switch the digital optical input (S/PDIF) on a MacPro to 48kHz, it immediately reswitches to 44.1 !!!
    To reproduce (not sure of the english names, french OS here):
    - launch "Audio MIDI configuration"
    - select "Digital audio input" in Properties
    - try to switch Format to 48kHz / 24bit
    In a few seconds, the format reswitches to 44.1 !!!
    Even if feeding the optical input with a correct S/PDIF signal at 48kHz/24bit, no way to change the sample frequency to something other than 44.1, resulting in wrong tonality or distorted sound.
    Please Apple, fix this ASAP, this is just not usable in a pro or even semi-pro environment !
    Test on Leopard 10.5.8 and Snow Leo 10.6.2. I'm pretty sure it worked with Tiger.
    Bye.

    Thanks Keith, but i don't think Logic users could have a clue on this issue (no pun intended).
    I'm a Pro Tools and Nuendo user, so i'm a bit reluctant to ask in a Logic forum... Too many fanboys there IMHO...
    Thanks anymway.
    Bye.

  • Triggering an event with more than one item.

    Hello there,
    I've written an addon, part of which populates a UDF on the Validate event of the ItemCode Cell of the matrix on the Sales Order form.
    Although this works fine when the user inputs a single item, if the user selects multiple items from the 'List of Items' list, as each item is added to the Sales Order, the addon's event is only called for the first item added, even though I'm sure all of the items must be validated as they are put into the matrix - does anyone know why it wouldn't run the event for each indivdual item ?
    Is there a way I can capture the data as it's moved from the list to the matrix ?.. or something..?

    Hello,
    You can use the et_CHOOSE_FROM_LIST event in any case!
    Even when the user just enters the ItemCode it is getting fired..
    Check-out SDK Sample "C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList"
    Regards,
    Frank

  • Triggering two conuters with two digital signals

    Hi,
    i am doing some period measurements using a 6221 M-Series card with two counters.
    My problem is now to trigger them with two different digital TTL signals. How can i do this?
    (Period times Signal 1 <-> Trigger 1, Period times Signal 2 <-> Trigger 2)
    Has someone an example vi?
    regards
    Jens

    Here you can find an example, that shows how to use a trigger for a counter. It is not exactly what you want, but shows the rigth way. Hope it helps:
    http://zone.ni.com/devzone/cda/epd/p/id/1612

  • DIAdem triggering a framegrabber with a digital pulse

    Is DIAdem 9.0 able to send a digital trigger pulse to a frame grabber?
    Ist DIAdem in der Lage einen digitalen Triggerimpuls zu senden, um einen Frame Grabber zu starten?

    Please could you describe on wich interface of the famegrabber do you like to send a trigger pulse. Do you talk about a real hardware trigger input? If so, you need any digital I/O-Harware to do it. There is a lot of such Hardware supported by Diadem.
    Martin Bohm
    [email protected]

  • Using an internal sample clock with a digital input

    I am using an encoder to measure angle and velocity. The example that I have started with is here. https://decibel.ni.com/content/docs/DOC-6834. The problem I am having is with the Sample clock, I get a timeout at the DAQmx read. If I remove the sample clock the VI runs fine, but I have no idea of my sample rate. Below is the the problem setup with the Sample clock inline.
    Attachments:
    encoder with timer.JPG ‏50 KB

    Hi there, a couple suggestions: first , this is a post that it is suppose to be on the DAQ board. Second, you are not being clear about the error, try to include the error code, description and its location, is it coming out of the channel node or the timing VI? Also what hardware are you using?
    Now, If you open the example called "Measure Angular Position.vi" from the NI example finder, drill the DAQmx Create Channel, you will see that you are missing a couple terminals for the task configuration, I wonder if this is part of the error.
    Alejandro | Academic Program Engineer | National Instruments

  • Actionscript question-triggering MC event with other MC

    hello, i have a flash file of a scene. part of scene shows a lake. in the water is a faint outline of a fish swimming back and forth, sort of ghosted in the water. i want to click on it and have a fish jump out of the water. the ghosted fish and the jumping fish are 2 separate movie clips that have been independently animated. when I combine them into the scene using actionscript to trigger the jump, it doesn't work. very new to AS but i've learned enough to understand that the script should have an if/then command or a function saying that when mouse is rolled over and clicked the jump takes place. does the ghosted fish and jumping fish have to be in the same movie clip on separate layers? if they can be separate movie clips i would prefer that. what is the basis of the script that tells flash that when I click the ghosted fish it will trigger the jump? attached here is a link to my swf. it shows the animation of the 2 MC's independent of each other for discussion purposes. also deer is a button.
    just thought of other question. can a shape tween work with symbols? I have a cloud art that I want to tween into a thunderhead created in Illustrator and imported that I would like to shape tween but isn't working. do shape tweens only work with flash generated artwork?
    www.coroflot.com/public/individual_file.asp?from_url=true&individual_id=183107&portfolio_i d=2601533&is_featured=%2D1& 
    thanks!!

    Whats an easy way to rename files in MC?
    Pressing F6 fills the path to directory in opposing pane. I would like it to fill the selected file name instead, so I could change a few letters
    But of course default behaviour is required more often...
    Is it possible to make a customized F2 user menu entry that would only rename files?

  • Edge Triggered Callback Function with E Series DAQCard

    Hardware: DAQCard-AI-16XE-50
    Software: NI-DAQ 6.9.1 call from C++
    Q- Does anyone have sample code to initiate a callback function in C++ when a pulse edge is input to a DAQCard-AI-16XE-50? I am using ACH1 as the input channel. Pulse edge occurance will be low duty cycle.Below code doesnt work..
    (I could use a latch & poll but edge triggering would be cleaner!)
    status = Set_DAQ_Device_Info(1,ND_AI_FIFO_INTERRUPTS,
    ND_INTERRUPT_EVERY_SAMPLE);
    retValue=NIDAQErrorHandler(status,"Set_DAQ_Device_Info (FIFO Interrupts)",0);
    status = Set_DAQ_Device_Info(1,ND_DATA_XFER_MODE_AI,
    ND_INTERRUPTS);
    retValue=NIDAQErrorHandler(status,"Set_DAQ_Device_Info",0);
    status = Config_ATrig_Even
    t_Message(1,1,"AI1",3,1,1,0,
    0,0,0,0,(unsigned int)EdgeCallbackFunction);
    retValue=NIDAQErrorHandler(status,"Config_ATrig_Event_Message",0);
    Thanks Millions if you help!!

    Hi kittyKat,
    The easiest way to create an interrupt service routine or callback function triggered on a digital edge is to use DAQ Event Messaging. In C, you can program for your DAQ board by using the function Config_DAQ_Event_Message. The different events you can account for are:
    DAQ Event type 0 � Acquire or Generate N Scans
    DAQ Event type 1 � Every N Scans
    DAQ Event type 2 � Completed Operation or Stopped by Error
    DAQ Event type 3 � Voltage out of bounds
    DAQ Event type 4 � Voltage within bounds
    DAQ Event type 5 � Analog Positive Slope Triggering
    DAQ Event type 6 � Analog Negative Slope Triggering
    DAQ Event type 7 � Digital Pattern Not Matched
    DAQ Event type 8 � Digital Pattern Matched
    DAQ Event type 9 � Counter Pulse Event
    If you are not
    using your analog input on your DAQ board, you can setup an analog input and use your external signal as an external clock. This would involve you using one of the shipping examples for analog input with an external clock and adding the DAQ Event Messaging for Event 1 and have the interval be 1 value. Therefore, your callback function will be called every scan or every time your signal pulses high (as the external clock). I've included some useful resources below.
    Using DAQ Event Messaging under Windows NT/95/3.1
    http://zone.ni.com/devzone/conceptd.nsf/webmain/159C194435C8CA5786256869005EF6AE?opendocument
    DAQ Events and Occurrences
    http://digital.ni.com/public.nsf/websearch/9F3DAD3E227E4203862566C2005B11EB?OpenDocument
    Hope that helps. Have a good day.
    Ron
    Applications Engineering
    National Instruments

  • Change digital input to frequency

    Has anyone figured out an easy/slick way to convert a digital input into a frequency/Rate?
    I've got this prox switch out on the plant floor that monitors whenever a part goes by. A part goes by at regular intervals, except that once in a while a part may not be there (removed from product stream for QA reasons). Ok, so I want to know (on average, say in the last 2 minutes) what is the rate in parts per hour.
    I guess I kind of want an Derivative Object that will accept a digital input (logical) instead of numeric.
    I am currently using a POT as the input to a Derivative Object (updating in 2 minutes, and a time unit of 1 hour), and Incrementing the Pot with the Digital Input from the PLC. However this only works until the POT max's out, then I automaticly reset the pot to zero, and start incrementing again.
    I just figure it should be "cleaner" than this solution. Any ideas?
    Rich Anderson
    Automation Controls Engineer
    Anamax Group

    Hi,
    Instead of using a Pot that is updated by the Digital input, you could use a counter. On that one you don't need to specify a max and you can make it have a reset programmatically.
    That should be easier and better to use.
    Ricardo S.

  • Timer event with parameter

    Hi guys,
    I implemented a BPM with 3 Times inputs and 3 timers. I need to set the TimeDate of the Timer Event with the three inputs. How can I do it? I tried with to create a DataObject with three Time attributes, before the Timer activities I assign the inputs to the data objects and in the Time Date I inserted the Expression with the data object attributes but it doesn't work!
    I tried also to insert three string as inputs (instead the Time) and then I insterted a trasformation before the Timer activities but it doesn't work too...
    Please help me!
    Thanks

    I solved inserting -'2h' in the Timer expression...So the question now is: Why the input DateTime has increased of 2 hours? I will open a topic...
    Thanks

  • Why is my daqpad 6015 pulling down my digital inputs?

    I have a daqpad 6015 configured with all digital inputs. The input impedance appears way too low. It pulls down my signals to about a volt from 5V. I know the impedance is supposed to be 'high', the manual is very vague on this subject. Could the board be damaged? Analog I/O is functioning perfectly??? 5V is right where it should be...
    Help?

    Hello Wave_Man. Thank you for contacting National Instruments. The high impedance talked about in the manual is referring to the impedance on the input of the board, not the signal being input into it. A small impedance is actually preferred. What I think is happening is that your ground on your signal is different than your ground on you daqpad. When you connect them you should see 5 V. Please let me know if you have any questions. Have a great day!
    Marni S.
    National Instruments

  • Measuring Velocity with Digital Input

    I am not very familiar with digital inputs and so am having trouble picturing this system. I will be starting from scratch but will have PXI chassis' available. I will have about 381 events. Event 1 will trigger acquisition, and over the next 10 - 20 ms, I need to capture the next 380 events. I don't need to know how long each event stays high, only the time in relation to the first event. I would like to catch any event that stays high for at least 1 microsecond.
    Since it will require multiple chassis, I think I will just wire Event 1 to each chassis and so shouldn't have to worry about any syncing problems? A colleague has been looking at PXIe-6544 and 6545, but I'm not sure this is the right tool, and hoping there is a less costly alternative.
    Hopefully someone can give me a kickstart in the right direction.

    Hi Deskpilot,
    If you're looking at separate lines, then my previous idea would not scale so well (each X Series card only has 4 counters).  I like the idea of using an R Series board to do this and would suggest posting over at the Real Time Measurement and Control forum to double-check the feasibility. 
    If you had to do this with M/X Series boards, then the more efficient solution would be to use the Digital Inputs instead of counters.  The R Series should be more elegant but I thought I would type up the suggestion for M/X Series anyway:
    We have a few M/X Series Boards that have 32 clocked digital lines (48 digital lines total, but only 32 support HW timing).  Depending on the board selection, you could sample the digital lines at 1 MHz (PXI 6224,  PXIe 6323) or 10 MHz (PXI 6254, PXIe 6353).  Then, in software you could determine which sample the rising edge occurs on and use this to timestamp when the event occurs.  The two options would respectively give you 1us or 100 ns resolution.  
    The X Series (623x) cards have built-in timing and triggering for the digital lines.  The M Series cards (622x) need to take in the clock from another source (you can use a Counter Output to create a 1 MHz or 10 MHz clock which can be triggered by your first event).
    At 381 lines you'd require 12 boards.  Each board requires 2 terminal blocks for access to all of the lines.
    Again, I recommend looking into the R Series board for your task, I just wanted to post another solution in case somebody comes along with a similar issue but with a few less lines.
    Best Regards,
    John Passiak

  • How to acquire serial data on a digital input line with good performance?

    Hello,
    we have a performance problem with our realtime controller. Our objective is, to read a 24-bit long digital waveform from a digital input line. To do this, we supply a clock signal (236 KHz)  to the PFI1 Line of our DAQ Board. On each rising edge of the clock, a new bit is set on the digital input DI0.
    Our hardware which transmits the data, is triggered through a digital output from our realtime controller. On each edge on this output, the hardware starts a serial transmission of 24-Bits.
    Everything works fine except the bad performance of our realtime controller. We want to acquire the 24-Bits in a 1ms timed loop. To measure performance we wrote a test program. In that, we only triggered the hardware and transfered the data to the realtime controller. The task which is doing this job, has a approx. CPU-Load of 30%, which is, in my humble opinion, very high. The task is not waiting for data or anything else! We have earlier implemented a control which is also using a 1ms timed loop. This control is sampling 2 analog input signals, 2 counters. Futhermore it's sending telegrams with CAN and doing many calculations. The strange thing is, this much huger program has a CPU-Load of 25%. Does anybody know where the problem is?
    For the better understandig I attached our test-program to this text.
    We're using:
    PXI-8175 realtime controler
    PXI-6221 Multifunction DAQ
    Thanks!
    Regards, 
       Crest!
    Attachments:
    dig_test.zip ‏51 KB

    Hello,
    First of all 30% CPU-Load is normal because the DAQmx-driver needs a lot of resources.
    In your programm you should place a wait (for example with 1ms) into the while-loop which causes
    lower CPU-Load.
    If this is not enough you should build your vi like in the following example.
    Regards,
    Christian
    Attachments:
    Read Dig Port.vi ‏51 KB

  • Synchronize analogue inputs with digital inputs

    Dear fellows
    I am using NI-DAQ, PCI-MIO-16E-4 (new name is 6040-E, I guess) with LabView 7.0. I am working on neuro-physiological signal acquisition. I have 16 analogue input channels and one digital input channel. Digital input is acquiring a TTL level signal that is a reference to the onset of a particular event. I want to synchronise both analogue and digital signals.
    Any suggestion?
    Nabeel

    Nabeel,
    have a look on following KB:
    http://digital.ni.com/public.nsf/websearch/851A80A7AB2885E086256F4D000610E6?OpenDocument
    (it's similar with DI)
    regards,
    ThSa
    http://www.newgistics.com

  • I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel

    I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
    When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.

    StevenD: FYI, I did NOT give you the one star rating. I would never do that!
    StevenD wrote:
    Ow. Someone is grumpy today.
    Well, this is an assignment, so it is probably homework.
    Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
    This would make no sense unless all of it was just covered in class!
    This is not a free homework service with instant gratification.
    OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
    "...but have no idea where to begin".
    open notepad.
    decide on a format, possibly one line per indicator.
    type the document.
    close notepad.
    open LabVIEW.
    Open the existing VI with all the indicators.
    (are you still following?)
    look at the diagram.
    Who made the program?
    Does the code make sense so far?
    Is it a statemachine or just a bunch of crisscrossed wires?
    Where do you want to add the file read?
    How should the file be read (after pressing a read button, at the start of the program ,etc.)
    See how far you get!
    Message Edited by altenbach on 06-24-2008 11:23 AM
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for