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.

Similar Messages

  • Can't change sample rate for digital input on Mac Pro

    Hello all,
    on my Mac Pro with 10.4.10 I can't change the sample rate for the digital input. Whenever I choose 48000 or 96000 Hz it returns to 44100 Hz after a few seconds. Feeding a 24 bit/96000 Hz signal from an external ADC into the optical input doesn't help. No input signal is available for digital recording software such as Sound Studio or Cubase. After changing the sample rate in audio midi configuration to 96000 Hz the sound can be heard for a few seconds but when the setup returns to 44100 automatically the signal is, of course, lost.
    I've deleted all relevant preferences and restarted with resetting paramter RAM. Still the same. With external hardware such as M-Audio Firewire equipment setting the sample rates works properly.
    Thanks to all for helpful clues.

    Hi,
    when E&M signaling is configured on digital interface like the VWIC is, 2 or 4 wires operation is not applicable because there are no wires at all, and reported only for compatibility with the analog E&M card.
    Consequently, you cannot configure that and it will not make any difference to effect of the connection.
    Please rate post if it helps!

  • Callback for a state change on digital Input 6025E

    Hello All,
    I need to have a callback function invoked when a state change occurs on serveral digital inputs (interlocks, kill button etc.).
    I am using a PCI-6025E and traditional NI-DAQ. For test purposes I have connected the output P3.0 to the input P4.0 using a SCB-68
    terminal block and initialize the ports in the following manner:
    void initfunc()
    long nPattern;
    DIG_Prt_Config(1, 3, 0, 1); /* port 3 output */
    DIG_Prt_Config(1, 4, 0, 0); /* port 4 input */
    DIG_Out_Prt(1, 3, 0xff); /* set all outputs high */
    DIG_In_Prt(1, 4, &nPattern); /* returns 0xff */
    Config_DAQ_Event_Message (1, 1, "DI4", 8, 0xffff, 0xffff, 0, 0, 0, 0, 0, (unsigned long)(&myCallback)); /* callback on state change */
    Now later in my program I perform the following (again as a test) when a button is pushed on a dialog box.
    CDigioDlg:nKillBtn()
    DIG_Out_Line(1, 3, 0, 0);
    DIG_In_Prt(1, 4, &nPattern); /* returns 0xfe */
    My callback funtion never gets called on the state change. Now looking at the documentation for the Config_DAQ_Event_Message it says that
    it notifies traditional NI-DAQ applications when the status of an asynchronous DAQ operation (initiated by a call to DAQ_Start, DIG_Block_Out, WFM_Group_Control, and so on) meets certain criteria you specify.
    Eventually this routines will need to monitor these input lines continuously within a DLL. I want to call an initialization function within
    the DLL to configure the board and callbacks then return. I want the callback functions within the DLL to handle these state changes.
    Any help would be greatly appreciated,
    John

    Hello John. Thank you for contacting National Instruments. It looks like you are using the callback incorrectly. I found an example that uses the callback in Visual C++ with Traditional DAQ. This isn't the same setup as you are using, but it should give you a good idea of how to setup the callback. Please let me know if you have any questions. Have a great day!
    Marni S.
    National Instruments
    Attachments:
    DAQEvent3VC6.zip ‏5 KB

  • How can I measure the time between each two successive rising edges ,using Digital Input ?

    Hello
    I'm trying two measure the time in seconds between each two successive rising edges on a digital input .
    Till now I have managed to detect the rising edge ,increment a counter with each rising edge ,and snap the time at which the rising edge happenned
    all I need now is to subtract the current rising edge time from the previous rising edge time in order to calculate (T) which can be 1/frequency and display it in realtime to the user.
    but I don't know how to do this
    Can somebody please help me !!!
    Solved!
    Go to Solution.
    Attachments:
    Counter without time.vi ‏11 KB

    Woah!  
    Sorry Apok, but your code is becoming way too complicated/messy. I don't think that all of those shift registers or boolean conversion/operators are needed at all.
    If you want to measure the timing between two button presses then this is a different (much less complicated) way. It simply records the timing of the button press into a shift register then compares the two.
    Spoiler (Highlight to read)
    Of course this is a very quick and basic solution just to show you that it can be much simpler than you are making it (remember to use the mechanical actions of the buttons to get the behaviour you want).
    A better way would be to use an event structure looking at value changes of the buttons to determine the timings between clicks.
    -CC
    "If anyone needs me, I'll be in the Angry Dome!"
    Attachments:
    Time between clicks.vi ‏9 KB

  • 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. 

  • Digital Input Cannot Display this Video Mode Optimum Resolution 1280 x 1024 60hz.

    HP Pavilion h8-1360t, Windows7 home premium 64-bit,  AMD Radeon HD 7570 graphics card.
    error message: Digital Input Cannot Display this Video Mode Optimum Resolution 1280 x 1024 60hz. 
    I get the error message as soon as Windows opens and the desktop displays.  Then it goes black with that message.  I've been using the computer for awhile and I had it so that when I maximized a window it would go across both screens.  I have two monitors on the graphics card.  Somehow I changed the settings so that a program would maximize to one monitor or the other.   That is how I want it to work.  Maybe I activated HydraVision.  Now I have the problem when I start.
    Also now when I boot to Safe Mode I get the message that there is no AMD graphics driver installed, or it is not functioning properly.  I have tried to update it and the computer tells me I have the most recent version installed.   I would like to uninstall it and reinstall it, but I'm a little worried I won't get it installed and be without video.  Something like that happened to me once before years ago.
    Could someone tell me what I should do please?
    Thanks,
    Jim Allen

    HP support is here:
    http://www8.hp.com/us/en/contact-hp/contact.html
    In safe mode you should uninstall the driver, then try to boot normal again.
    Then check if driver was installed by win7.
    If not go go AMD website and download latest driver for your card.
    V.
    *** Say 'Thanks' with Kudos ***

  • "External sample clock" and "Rate" for digital input acquisition

    Dear all,
    I want to acquire digital input (21 bits with external clock = 50 kHz) with a PCIe-6343 NI board. Using the  DAQ assistant under Labview, I selected the advanced timing with the sample clock time parametrized as External. However, it is also possible to select the Rate of the acquisition. In my case, i want to get the data at the rising edge of the external clock signal, so at a frequency of 50 kHz.  How can I do that ? I just need to put a Rate of 50 kHz ?
    thanks for your help.
    Cedric 

    Cedric,
    dddsdsds wrote: 
    [...]In my case, i want to get the data at the rising edge of the external clock signal, so at a frequency of 50 kHz.  How can I do that ?[...]
    You answered your question already. If you want to use an external clock, you have to configure the timing source of your task to be external. In order of proper buffer configuration, you should enter 50kHz as rate in addition to the external configuration, but this will not influence the speed of the acquisition (since it is "clocked" externally!)
    hope this helps,
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Producer consumer with analog and digital inputs and outputs

    Hi everyone,
    I am working on a control system program for some practical test work. Currently I am working on the data acuisition component of the Labview program. My architecture is produced-consumer loops with a que. My system will have analog inputs, analog outputs, digital inputs and digital outputs. It's not a time critical sytem, but I would like all of the data acquisition to be synchronised. I have attached my program as it is at the moment. I am having trouble getting all of the data into the que since I have two data types. Also, I'm not sure if i've synchronised the four read/write sequences correctly. I would greatly appreciate if somebody could take a look at my program and give me some advice. Thanks in advance.
    Solved!
    Go to Solution.
    Attachments:
    control_v2_DAQ loop.vi ‏46 KB

    Robert, the specific error that I get is:
    Error -200462 occurred at DAQmx Start Task.vi:6
    Possible reason(s):
    Generation cannot be started because the output buffer is empty. 
    Write data before starting a buffered generation. The following actions can empty the buffer: changing the size of the buffer, unreserving a task, setting the Regeneration Mode property, changing the Sample Mode, or configuring retriggering.
    Task Name: Heater testing lab digital outputs
    This error occurs at the 'DAQmx write.vi' function. I just want to sent one sample per second, for each channel. I would like the producer and consumer loops to each run once every second.
    I have attached part of my code with just the data acquisition and writing. Any help would be greatly appreciated.
    Attachments:
    control_v2_ML_simple.vi ‏83 KB

  • How to wait for a digital input to go high?

    I bet the following question is explained somewhere but I don't know how to find it.
    Is there an optimal way to wait for a digital input to transition from 0 to 1? I mean, other than creating a loop that continously polls the input line is there a better way to wait for the transition? With all the "event driven" capability of CVI I suspect there's a slick way to do this but I don't know how to find it. I'm willing to RTFM if I know where to look.
    thanks

    Hi,
    I have never done this, but it looks like it is possible to use the DAQmxRegisterSignalEvent function to assign a function that will be called when a "change detection event" occurs.
    It works on a task basis, so if I'm not mistaken, you need to put the digital to be tracked into a separate task. 
    It is not stated if all NI hardware is compatible with this functionality, so try and see if it works for you.
    Hope this helps,
    Edit: It looks like you have already found the solution by yourself
    S. Eren BALCI
    www.aselsan.com.tr

  • Use digital inputs to choose inquiry sequence?

    Hello,
    Is it possible to use a couple of the NI-1456 CVS TTL Digital Inputs to select which specific Inquiry Sequence should be ran?
    I currently own NI Vision Builder for Automated Inspection.  I do not own LabView.
    I am using a NI-1456 CVS and firewire camera.  My solution will use the NI-1456 CVS stand-alone.  It will not be connected to a VGA monitor, or to a computer.  I intend to use the system to detect flaws in silicon wafers.  Due to several possible wafer sizes and shapes, I will have to develop an Inquiry Sequence for each wafer type.  I would like to have the NI-1456 CVS unit contain several Inquiry Sequences.
    -Rick

    Hi Rick -
    Actually, this is a very commonly used feature of VBAI!  From the Configuration Interface, choose Tools»Configure Inputs/Outputs.  This will pop up a settings window for the entire inspection process.  The second state (called "Change Inspection?") allows you to configure a Product Selection port.  The digital byte written to this port will determine which inspection script to run.  From the listbox, you can choose NI CVS/IMAQ IO Product Selection to use your CVS's digital input port for this feature.
    More information about this feature can be found int he NI Vision Builder for Automated Inspection Configuration Help, under the following index: Vision Builder AI Tools»Configuring Inputs/Outputs»NI CVS-1450 Series I/O.  Note that the ISO inputs are used for this feature, not the TTL inputs.
    David Staab, CLA
    Staff Systems Engineer
    National Instruments

  • Time between digital inputs?

    Hi, I would like to measure the time between a digital input being true.
    Basically I have a prox picking put a point on a rotating shaft (to determine RPMs).
    What I want to do is measure the time between consecutive input signals from the prox, divide 1 rev by the time, multiply this by 60 to get RPMs. Then compare that value to a set value ( say 300 RPM ). If it is equal or great, contine onto the rest of the program, if it is less than the set value, keep looping until it is greater than or equal to the set value.
    Thanks in advance for the help!
    Ryan
    LV 7.1

    If you need to measure accurately the rotation speed on a single turn, software timing may not be accurate enough, since the Window internal clock readings have lags (read "errors") of more than 10 ms (= 100 rps, about 2 rpm error), even when no other application is running. So either you count (and wait) for a given number of rotations, and calculate an average, or you use hardware timing with a counter on the DAQ card (if any)...
    Otherwise, if you only need an estimate of the rotation speed, you can read the digital line and wait for 2 consecutive changes. The period can be calculated from the time stamps. See the attached vi. Wait a few seconds to observe the variations generated by Windows.
    Merry Christmas, and Happy Wiring !
    CC
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Rotation speed.zip ‏14 KB

  • Digital Inputs do not record over long time periods

    I am running Signals Express 2009 with a USB-6009.  I have a project that needs to record the states of 8 digital inputs over a 24 hour period.  The inputs typically do not change state for long periods of time.  When I run the project it does record and gather data if I stop it "soon"(I have gone as long as 30 min.)  When I leave it running overnight it does not appear to record anything.

    If you have not already, you should try turning off display updates in the "Operate »Update Signal Views While Running" menu item.  Set this to Update None.  Also, turn off "Prepare log data for viewing" under the Logging part in the Tools » Options dialog.  
    When I ran your project overnight, it ran out of memory.  The first error it threw was "Not enough memory to complete this operation."  The problem was that SignalExpress saved a great deal of data in memory for easy displaying while it's running, but this grows too big when it runs overnight.  The second error was as follows:
    Logging Stopped:
    Logging was stopped because an error occurred with a Step in the Project. 
    If this error is because of a device buffer overflow, you can improve performance by turning off display updates using the "Operate »Update Signal Views While Running" menu item.
    You can also change the way signals are logged by changing the Logging Options in the Tools»Options dialog.  
    Turning off  the "Prepare log data for viewing" will greatly improve performance. 
    Mark E.
    National Instruments
    Schedule a Free 1-Hour online LabVIEW Tutorial with an NI Applications Engineer

  • Digital inputs NI6220

    Hello!
    DAQmx Version 7.3
    I want to read the digital inputs of a NI6220. There is no matter of timing,
    I only want the actual state.
    I get the error code -200077 from the StartTask, that means:
    "Requested value is not a supported value for this property.
     Property: DAQmx_SampTimingType
     Requested Value: DAQmx_Val_SampClk
     Task Name: MyDigital
     Status Code: -200077"
    How do I have to configure this device correctly? I didn't find the source with the properties.
    Thanks in advance
    Ralph Müller
    Here is the pseudo-code I use:
    deviceName                  = "Dev1";
    taskName                    = "MyDigital";
    rate                        = 1.0;
    lengthDataPerChannel        = uint32(2);
    lines                       = "Dev1/line0:15";
    nameToAssignToLines         = "DigitalChannel";
    lineGrouping                = DAQmx_Val_ChanForAllLines;
    numSampsPerChan             = int32(1);
    readArray                   = uint32(255);
    arraySizeInSamps            = uint32(1);
    reserved                    = uint32(0);
    status1     = DAQmxCreateTask(taskName,taskHandle);
    status2     = DAQmxCreateDIChan(taskHandle,lines,nameToAssignToLines,lineGrouping);
    status3     = DAQmxCfgSampClkTiming(taskHandle,"OnboardClock",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,lengthDataPerChannel);
    status4     = DAQmxStartTask(taskHandle);
    printf("Handle, Status: %d; %d; %d; %d, %d\n",taskHandle,status1,status2,status3,status4);
    for n = 1:10
        pause(1);
        status1   = DAQmxIsTaskDone(taskHandle,isTaskDone);
        status2   = DAQmxReadDigitalU32(taskHandle,numSampsPerChan,0,DAQmx_Val_GroupByScanNumber,readArray,arraySizeInSamps,sampsPerChanRead,reserved);
        status3   = DAQmxStopTask(taskHandle);
        status4   = DAQmxStartTask(taskHandle);
        printf("Status: %d(%d); %d(%d); %d; %d, %d\n",status1,isTaskDone,status2,sampsPerChanRead,status3,status4);
        printf("Readarray = %d\n", readArray);
    end
    status1    = DAQmxStopTask(taskHandle);
    status2    = DAQmxClearTask(taskHandle);
    printf("Status: %d, %d\n",status1,status2);
    I get the following printout:
    Handle, Status: 530841864; 0; 0; 0, -200077
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0(1); -200077(0); 0; -200077, Readarray = 0
    Status: 0, 0

    Hello!
    thank you, John, for your hint. I tried the second part (ctr0internaloutput), but
    still get the same error (-200077).
    Here is the way I actually tried:
    Variables as in my former email, additional these here:
    taskNameCounter             = "CounterTask";
    counter                     = "Dev1/ctr0";
    nameToAssignToChannel       = "CounterChannel";
    units                       = DAQmx_Val_Hz;
    idleState                   = DAQmx_Val_Low;
    initialDelay                = 0.0;
    freq                        = 10.0;
    dutyCycle                   = 0.5;
    status1  = DAQmxCreateTask(taskNameCounter,taskHandleCounter);
    status2  = DAQmxCreateCOPulseChanFreq(taskHandleCounter,counter,nameToAssignToChannel,units,idleState,initialDelay,freq,dutyCycle);
    status3  = DAQmxStartTask(taskHandleCounter);
    printf("Handle, Status: %d; %d; %d; %d\n",taskHandleCounter,status1,status2,status3);
    Then the code of my former eMail, but I changed only one line to this:
    status3     = DAQmxCfgSampClkTiming(taskHandle,"/Dev1/ctr0internaloutput",rate,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,lengthDataPerChannel);
    The error is the same as before (the startTask of the normal taskHandle returns -200077).
    o.k. then stop and delete all tasks.
    Can you give me more details or an example?
    Thanks!
    Ralph

  • I want to measure rpm using 100 ppr incremental encoder via digital input

    i want to measure rpm using 100 ppr incremental encoder  via digital input max speed (4000 rpm)
    am using 9178 c-DAQ chassis and 9426 digital input module
    pl provide me example code for this

    Hi asaccullo.
    The recommended settings for encoders are using the counters in the daq cards. Using digital I/O’s is not recommended, the encoders send digital signals but one of the main differences between using digital IO vs counters is that counters are designed to handle these type of events.
    Here I found several examples in ni.com/code that you might check:
    Imitation Quadrature Encoder with DAQmx Counter Tasks
    Use Counter Frequency to obtain an Encoder Rotational Speed
    An Elvis is a daq device, so this should work for you.
    I also found an example for myDAQ, it uses the DIO but with a counter task in the set up.
    Regards,
    steve.bm
    AE | NI

  • Responding to a field Digital Input immediatle​y..

    In a code for a a test rig ( LV7.1 + Win XP ) I am scanning all digital
    inputs once every 50ms inside a timed loop. But there is one input from
    a proximity switch that I need to be able to respond to immediatley as
    it changes state.
     Any delay  of even a few ms, will add on to the reversal error of a servo drive motor.
     Ideally what I am looking for is a kind off  Interrupt
    or  Event Structure for an external field input.  I know this
    is not there in LV, but would be ineterested in achieving the same
    functionality by some other means.
    Thanks
    Raghunathan
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    Hello Raghunathan,
    It LabVIEW if you are polling your device every 50ms for data, you will only get updates from your device every 50ms. It sounds like you are looking for some sort of change notification or change detection from your board. It is likely that you will get a much better and faster response to this question on the Multifunction DAQ or Digital I/O discussion forums since this is primarily a hardware question. If you decide to post to the hardware discussion boards, it may also be a good idea to list the specific hardware you are using so that people with similar setups can share their experience.
    Best of luck,
    Chris J
    Multifunction DAQ board
    http://forums.ni.com/ni/board?board.id=250
    Digital I/O board
    http://forums.ni.com/ni/board?board.id=70

Maybe you are looking for

  • Vendor and Customer initial upload in SAP

    Dear All, When I upload vendor opening balance to SAP, my upload account and vendor accounts are updated correctly. Total no of vendor 450 But in vendor recon account (GL Account), its creating 450 line items for vendors. Can i bring it as one line i

  • OLE-Word with table

    Hi, i use OLE-Word to create a table in a word document and fill them. That's work OK, but i will position the table on a specific Positon on the page. Position shell be horizontal 7 and vertical 8. I have tried it with recording in word, bot i don't

  • Empty printer file!

    After successfully following the directions at http://docs.info.apple.com/article.html?artnum=107054 due to a "server-error-service-unavailable" message, I was able to add the printer Dell Laser 1720 (driver downloaded from Dell site). When I try to

  • Desktop Pictures Will Not change each day.

    I have System Preferences set to change the Desktop Picture each day. When system starts it loads the new picture and then the same one used before loads over it. I have tried to have it change at each login and the same thing happens. If I change it

  • WMI query hanging

    I have some code (VB Script) that is collecting CPU performance metrics from WMI.  The code works well on all of the servers (identical servers) but after a period of time (8 hours, 30 hours, other random times) on some of the servers the query hangs