Measure separation between two signals that may be coincident

Hi
I need to determine the time period between two pulse signals. I'm going to assume for now that I can get these pulses as TTL.
I was initially drawn to the 'Two-Signal Edge-Separation' method using two counter inputs. However, it's quite possible that the signals would be coincident some of the time. Could anyone please answer the following questions:
If my signals were coincident, would the 'two-signal edge-separation' measurement be armed on the edge of signal 1 (= same time as edge of signal 2) and continue counting until the next edge of signal 2 as shown below? Or is it re-armed on the next edge of signal 1?
Is there any other method I could use to log the time between my two pulses? Either as simultaneous counter outputs or something completely different (non-counter method maybe)?
(Probably not relevant at this stage, but I will be using Measurement Studio to implement this - hardware as yet unselected).
Thanks in advnace for any help.
CAS
Solved!
Go to Solution.

Hi CAS,
The count is not re-armed on the next edge of signal 1 using the two-edge separation mode.  Once the counter is armed the first time, it will continue counting until signal 2 is detected.  
Alternate Approach 1:
If you want the count to reset on every edge of signal 1, you could configure an edge count task (counting the internal timebase) using signal 1 as the count reset terminal and signal 2 as the sample clock.  You still would have uncertainty of which signal is detected first if they occur at precisely the same time, so your measured result might be close to 0, or it might be close to 1 full period of the signal in the case that signal 1 and signal 2 are identical.
If you wanted to remove this uncertainty, you can actually delay signal 2 by enabling the PFI filter for the signal 2 terminal.  The original intent of this feature was to be able to add a debounce filter to avoid picking up multiple edges on transitions, but a result of the implementation is that the signal is delayed by some amount of time (between the pulse width guaranteed to pass and the pulse width guaranteed to not pass).  The best case scenario would be X Series using the 100 MHz timebase, you would add 10 ns of jitter but you could delay the signal by an arbitrary amount.  So, you can add the delay and account for it in your reported values, but you would run into problems if the delay caused signal 2 to occur after the 2nd edge of signal 1 (i.e. if the signals were already close to 1 full period apart).  You'd have to have an idea of the maximum frequency of the signals as well as the maximum delay between them to determine if this would work or not.
Alternate Approach 2:
You could use two counters configured as edge count tasks.  Count the fastest internal timebase.  Sample the first counter off of signal 1, and the second counter off of signal 2.  If you arm the counters together and ensure that signal 1 and signal 2 start at the same time, then you can simply subtract your buffered samples of counter 1 from your buffered samples of counter 2 to get an array of differences.
There are a number of other ways you could get similar results, but I think the above 2 suggestions are probably the easiest to implement.  Alternate Approach 1 has the advantage of still only requiring 1 counter and you don't have to worry as much with arming the counters and starting the sampling together (which could be a problem with Alternate Approach 2 if signal 1 and signal 2 are free-running).
I would recommend X Series DAQ for this task for the following reasons:
The count reset feature mentioned in Alternate Approach 1 is only currently available on X Series and 2nd Generation cDAQ.  It will hopefully be added in the somewhat near future to M Series with a driver update but I can't make any guarantees.
The 100 MHz timebase on X Series gives a 10 ns resolution to your measurement.  M Series and cDAQ use an 80 MHz timebase (12.5 ns resolution), and E Series uses a 20 MHz timebase (50 ns resolution).
X Series have the most flexible digital filters on their PFI lines and the PFI filters introduce the lowest jitter (compared to M Series and 660x that is--E Series devices do not have digital filters at all).
You didn't mention what frequency you would be using, but X Series have on-board FIFOs which will help you avoid errors from samples being overwritten if your external frequency is relatively fast.
X Series are priced similarly to their M Series equivalents.  All X Series have the same counter features with the lowest cost X Series being the PCIe-6320.
Best Regards,
John Passiak

Similar Messages

  • Better estimation of phase difference between two signals with variable frequency!

    Hello LabView Gurus, 
    Being a power engineer and having just a little knowledge of signal processing and labview, I have been pulling my hair out for the last couple of days to get a better estimation of phase difference between two signals.
    We have two analog voltage signals; 1. sine wave (50Hz ± 1Hz) and 2. a square wave with exactly half of sine wave frequency at any time.
    At the starting point of operation (and simulation/acquisition) both signals will have no phase difference. However, the square wave's frequency changes unpredictably for a just a few millisecond but then it gets synchronized with sine wave's frequency again. This means that the square wave will be phased out from its original position. The task of the labview is to find the phase difference between the two signals continuously.
    My approach to determine the phase difference is to measure the time when sine wave crosses zero amplitude and the time when the very next square wave changes amplitude from zero volts to +ve voltage (I have a 0.5volts threshold just to avoid any dramas from small line noise). The difference between these times is then divided by the time period and multiplied by 360 to get this phase difference in angles. 
    As this part is just a small block of a big project, I can only allow 5000Hz sampling rate each for both signals. I read 500 samples (which means I read data from 5 cycles of sine wave and 2.5 cycles of square wave).
    Now the problem is, as long as the frequency of sine wave stays constant at exactly 50Hz, I get a good estimation of the phase difference but when the frequency changes even a little (and it will happen in the real scenario i.e 50Hz ± 1Hz  and the square wave's frequency is dependent of sine wave's frequency), the estimation error increases.
    I have attached my labview program. From front panel, you can set the phase of square wave (between -180 and 0) and you should see the labview's calculated phase in the indicator box named 'Phase'. Then you can press 'Real Frequency' switch that would cause the frequency to change like it would in real operation.
    You can observe that the estimation error increases after you push the button. 
    All I need to do is to reduce this estimation error and make it as close to the actual phase difference as possible. Any help would be greatly appreciated.
    I am using LabView 2009 for this task.
    The application is for electric machines and the stability/performance of machines under different faults.
    Thank you for reading this far!
    Regards,
    Awais
    Attachments:
    v603.png ‏320 KB
    v603.vi ‏186 KB

    Jeff Bohrer wrote:
    Basic math gives me a bit of pause on this approach.  You are sampling at 50 times the frequency of interest so you get 50 samples per cycle.  your phase resolution is 1/50th cycle or 7.2 degrees +/- noise.  You will need to samlpe faster to reduce phase resolution or average multiple readings (at a time cost that is signifigant)
    Jeff- (Hardly Working)
    I am sampling at 100 times the sine wave's frequency and 200 times the square wave's frequency.  Increasing the sampling rate completely solves my problem. But since I am acquiring several other inputs, I cannot afford a sampling rate higher than 5kHz.
    F. Schubert wrote:
    I'm not a signal processing expert, but here my basic understanding.
    If you simulate sampling with 5kHz and a frequency of 50 Hz (and both are 'sync' by design), you always get an exact 5 periods. Any variation of your signals frequency gives you a propability to get 4 or 6 'trigger' events. That's an up or down of 20%!
    The one measure to reduce such problems is using 'window functions'. They don't fit your current approach (counting instead of a DSP algorithm), so this needs to be reworked as well.
    My approach would be to use the concept of a Locki-In amplifier. You need to phaseshift your ref-signal by 90°. Then multiply your measurement signal with the ref signal and the phase shifted ref signal. The obtained values for x/y coordinates of a complex number. Calculate the theta of the complex number (with the LV prim). Feed this in a low pass filter.
    The trick on this is, that the square wave has harmonics in it, in this you are interested in the second harmonic which is the sine wave.
    To get rid of the effect that the sync between sampling rate and ref signal frequency gives an error, you then can use the window I mentioned above (place it before the lock-in).
    For a design that really plays well, use a producer-consumer design pattern to get the calculations done in parallel with the DAQ.
    I suggest you to check on wikipedia for some of the keywords I mentioned. Go also for the external links which lead to great tutorials and AppNotes on the signal processing basics.
    Sorry, it's not a simple solution I offer and we will have quite some conversation on this forum if you follow this path. Maybe someone else knows a simpler way.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml
    An interesting view. the sine wave can indeed be looked as a second harmonic of the square wave. I will implement your idea and get back to you as soon as I get some results. But since I have very limited knowledge of signal processing, it might take me a while to get my hear around the solution you mentioned.

  • How to find the phase difference between two signals using Hilbert transform

    hi, 
        I am new to LabView.... I am trying to find phase difference between two signals. I sucessfuly found out the phase difference between two predefined waves using single tone measurement. .... But I really want to know how can I measure phase difference between two signals( not predefined... ie we don't know the initial conditions) using hilbert transform or any transformation techniques (without using zero cross detection).. I tried by using hilbert transform based on algorithm... bt I am getting error.... plz help me
    Attachments:
    phase_differece.vi ‏66 KB

    you could try something similar to this, for each table pair that you want to compare:
    SELECT 'TABLE_A has these columns that are not in TABLE_B', DIFF.*
      FROM (
            SELECT  COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
          ) DIFF
    UNION
    SELECT 'TABLE_B has these columns that are not in TABLE_A', DIFF.*
      FROM (
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_B'
             MINUS
            SELECT COLUMN_NAME, DATA_TYPE, DATA_LENGTH
              FROM all_tab_columns
             WHERE table_name = 'TABLE_A'
          ) DIFF;that's assuming, column_name, data_type and data_length are all you want to compare on.

  • How to measure distance between two points uisng uiaccelerometer

    Hello all,
    I am trying to measure distance between two points.So for that i am used uiaccelerometer but its give only rotation changes. I am moving my whole device from one point to another point so for that all x,y & z changes remain same. So how can get the device movement for that?
    Thank you..

    UIAccelerometer does not give rotation changes, it senses acceleration in each of the 3 axis in g-force units. Moving in a plane from one point to another and stopping will result in a net g-force in that axis of zero. To get distance one has to measure the initial acceleration and then the time before a deceleration is detected. It gets really complicated in real life since the start and stop are not instantaneous.

  • Can counter measure pulse width difference between two signals

    I am interested in determining the high pulse width time that two signals have when they are in various phases between eachother.

    Why don't you try one of the pulse width examples. I don't know what ADE you are using, but you can search for examples (http://www.ni.com/devzone/dev_exchange/ex_search.htm) with the key words "+pulse +width" and find several examples in different languages. This will measure the pulse width of one signal, but you can program most of the counters to do multiple tasks at the same time. Just copy the code twice and change the counter number to program counter 2 as well. If you want the ORed pulse width time, I would recommend adding a OR gate to your circuit and then feeding that into a counter.
    I hope this helps.
    Joshua

  • Late between two signal ?

    hey, sorry for this question i think that the answer ei very simple.
    I generate a squared signal with labview Vi in a fpga and with a Compact RIO module.
    I have two signal with the same frequency and with the same duty cycle time.
    I want to create a late between my two signal.
    I will have 120° between my signals.
    If you have idea for me....( the code can be implement in fpga)
    Best Regards
    François

    Hi,
    To have information abourt this forum, refer to this link:
    http://forums.ni.com/ni/board/message?board.id=4170&message.id=9244#M9244
    .NIDays2008 {font-family:Arial, Helvetica, sans-serif; font-size:12px; color: #065fa3; font-weight: bold; text-decoration: none; text-align: right;} .NIDays2008 a, a:hover {text-decoration: none;} .NIDays2008 a img {height: 0; width: 0; border-width: 0;} .NIDays2008 a:hover img {position: absolute; height: 90px; width: 728px; margin-left: -728px; margin-top:-12px;}
    >> Avez-vous entendu parler de NI Days ?

  • How can I measure coherence between EEG signals using labview?

    well, I have an EEG signal(a matrix 16X8498)whose lines represent the channels and collums the samples. The last line is the stimulus channel. I would like to know if I can measure the coherence between my EEG channels(lines)using labview.If,yes,is there someone who has the block diagram?

    Search the Labview help for coherence and you'll find several functions (in Labview 6.1 Full Development System). The functions are in the palette Analyze >> Waveform Measurements >> Frequency Response Function (Mag-Phase) or (Real-Im).

  • Measure phase difference between 2 signals

    I am very new to labview. i m trying to use labview to measure phase between 2 signals from encoder. I also want to measure the state of 2 quadrature square signals. anyone has any idea how to do it?

    Hi "rvn10",
    Quadrature encoders do by nature have a phase difference of 90 degrees between channel A and B. This phase difference is required to know in which direction the shaft is rotating when a transition from one of the channels is received. Please see these two links for some useful information:
    Encoders
    Linear and Rotary Encoders
    Quadrature Encoder / Position Measurement
    If your goal is to measure the angular position using the two quadrature square signals, then your task is quite simple if you use one of our Counter/Timer cards. Check for example the shipping example called "Measure Angular Position.vi".
    If you want to read more about our most affordable Counter/Timer product, then check this link:
    NI PCI-6601
    Please let us know if you are using different hardware to acquire the signals.
    - Philip Courtois, Thinkbot Solutions

  • How to insert an image between two pages?

    How to insert an image between two pages? and how do remove the line of separation between two pages?.
    Attached image shows, there is a photo of two pages and no line of separation in the pages!

    Michi Thanks, but that option is only available on one page (2 columns), not to put two pages! see new image

  • Is it possible to add a firewall between two mpls peers (P-PE)

    Hi, I was wandering if there is a way between two routers that 'speak' MPLS to introduce a firewall (i.e. pix firewall). I know by default is not possible but perhaps through tunneling etc?
    Ragards.

    Hi,
    No, it is not possible at least for today. The packets between P and PE router are not IP packet but MPLS packets (it protocol type is different). One exception to that is penultimate hop poping. If P-H-P is placed and there is no other label stack (ex : no vpn ) the packet is pure IP packet.
    Also one of the main idea of MPLS is that P router doesn't know anything except label binding information.
    If you want to use firewall somewhere , use it on the CE side not between P-PE,P-P or PE-PE.
    Best Regards

  • N bridge between two 1252an in bridge mode at 5GHz

    I've read in some of the cisco documentation on the 1250 series that root bridge or non root bridge modes are "not tested". They don't say "not supported". I have a client that could use a high bandwidth link between two buildings that are 100' or so apart. The fiber link has already been busted twice. Heavy heavy trucks kill the ground concrete. I have configed a 54Mbps solution with two 1242G's and some cisco yagi's. But, if an N bridge is possible with two 1252AG's, and go faster than the 54Mbps..I'd go with that setup.
    Cisco documentation says the bridge modes show up in the 1252 webgui and are selectable. They just end it with "not tested".
    Any thoughts?

    It became supported in recent versions of the 1250 IOS.
    |With this feature, the Cisco Aironet 1140 and 1250 Series can be configured for both access point and bridge functions. Bridging support on 802.11n access points offers added performance, reliability and throughput for basic wireless LAN coverage, wireless LAN coverage with wireless backhaul, and more traditional bridging applications.|
    http://www.cisco.com/en/US/partner/prod/collateral/wireless/ps5678/ps6087/product_bulletin_c25-560118_ps6973_Products_Bulletin.html
    Nicolas
    ===
    Don't forget to rate answers that you find useful

  • Can Partial Trigger Work between Two Components Which Are in Two Pages?

    Scenario: Some output text components in page one while a SelectOneChoice and a InlineFrame are in page two. At first the resource attribute of inlineFrame was set to point to page one. When changing the value of SelectOneChoice, the values of those output text will be expected to change accordingly. I tried to make SelectOneChoice to be the trigger of those output text components, but found that SelectOneChoice can't be seen when attempt to edit the value of PartialTrigger attribute of those output text components. Then I tried to set the ID of SelectOneChoice as the value of the InlineFrame component, but failed getting the wanted result again.
    Problem: How to get a partial refreshing effect between two components that are in two different pages? Can partial trigger work in this scenario?
    Thanks for your interest!

    Hi,
    Sorry, you can't achieve that the way you're doing it. If you're using 11g, however, you could do that using regions.
    Regards,
    ~ Simon

  • Finding Distance between two zipcodes with longtitude and latitude

    Want to find distance between two zipcodes that have their latitude and longitude stored in a table.
    The table is as follows
    CREATE TABLE distance (zipcode VARCHAR2, LNG NUMBER, LAT NUMBER)
    I couldn't come up with a calculation or understand the mathematical calculation on line.. Can you help me with some stored procedure that will do..?
    Thanks

    There is no logical complexity in your query besides knowing the basics of
    http://en.wikipedia.org/wiki/Spherical_coordinates
    Also, the table name "Distance" cannot be more confusing; what you have is essentially "PointsOnSphere".
    select R*sqrt(
    (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))* (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))
    +
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))*
    (sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))
    +
    (cos(pi-p1.lng)-cos(pi-p2.lng))*(cos(pi-p1.lng)-cos(pi-p2.lng))
    from distance p1, distance p2
    where R is the radius of Earth, and pi=3. Don't forget to convert angular degrees into radiants before you plug in them into the query above
    Correction: This was euclidean distance sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) between the points (x1,y1,z1) and (x2,y2,z2). Spherical distance is
    sqrt(
    (R*(colatitude1-colatitude2))^2+
    (R*sin(colatitude1-colatitude2)*(longtitude1-longtitude2))^2
    Message was edited by:
    Vadim Tropashko

  • How to query the number of working days between two dates

    I'm looking for a solution to calculate the number of <i>working</i> days between two dates that I can use in a formated search. 
    Calculating the total number of days is pretty straight forward but does anyone know how to take into account the settings in the HLD1 (Holiday Dates) table?

    Hi Eric,
    If you are purely looking to exclude holidays defined in the HLD1 table, then you should be able to do it with the following query
    NOTE: The following query is an example using OINV table and the fields DOCDATE and DOCDUEDATE for a Particular DOCNUM  'xxx'
    If you planning to use within the SAP module then replace DOCDATE and DOCDUEDATE with dynamic field references $[$x.x.x]
    SELECT DATEDIFF(DAY,T0.DOCDATE,T0.DOCDUEDATE)-
    (SELECT COUNT(STRDATE) FROM HLD1 WHERE STRDATE >= T0.DOCDATE AND STRDATE <= T0.DOCDUEDATE)
    FROM OINV T0
    WHERE T0.DOCNUM = xxx
    Best Wishes
    Suda

  • Database mirror between two domain

    I setting up database mirror between two domain that will help me migrate from SQL 2008R2 to SQL 2012 :
    It is set up as follows:
    Domain A(Old domain) - Server A
    Domain B (New Domain for HA/DR setup) - Server B and Server C (Already configured as FCI and AG)
    I want to migrate data from Server A to Server B using database mirror.
    I set up the
    Created Master key, endpoint and certificate on the Server A
    Created Master key, endpoint and certificate on the Server B
    Backup certificate on both sides and copy to each server
    Create inbound connections on both principal and mirror partner. Here I created two SQL logins
    SQLSrvA_login
    SQLSrvB_logi
    Grant connect on endpoint to both logins on both principal and mirror partner.
    Everything seems ok as can be seen below
    Principal partner:
    grantee        endpoint     permission  state_desc
    SQLSrvA_login        Hadr_endpointCONNECT      GRANT
    SQLSrvB_loginHadr_endpointCONNECT GRANT
    Mirror partner:
    grantee        endpoint     permission  state_desc
    SQLSrvA_login        Hadr_endpoint  CONNECT      GRANT
    SQLSrvB_login   Hadr_endpoint  CONNECT GRANT
    Perform a full db backup and log backup on ServerA and restore to  ServerB with norecovery
    When trying to establish the partnership, it succeeded on the mirror partner ServerB   but failed on the principal partner ServerA with the following error
    Msg 1418, Level 16, State 1, Line 2
    The server network address "TCP://ServerB:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational.
    The following error is in the SQL errorlog:
    Database Mirroring login attempt failed with error: 'Connection handshake failed. There is no compatible authentication protocol. State 21
    Any ideal why this is occurring?
    Thanks
    Datawarehouse lead Architect

    Hi,
    Please see this link for possible solution.
    http://blogs.msdn.com/b/grahamk/archive/2008/11/21/how-to-configure-database-mirroring-between-2-instances-on-a-standalone-server.aspx
    Hope this helps
    Bhanu

Maybe you are looking for

  • Usage of field-symbol to internal table generically.

    Hi gurus, please tell the usage of field symbol to an internall table. how do i use field symbol generically , so that i can use same field symbol for many different internal tables. regards, krishna TABLES: EKKO. DATA: ITAB TYPE STANDARD TABLE OF EK

  • PR - RFQ

    dear all I want to see list of PR for which no RFQ created & RFQ created please its Urgent

  • Capturing Data from forms before it is stored in the table

    Hi...I would like to capture data from a form before the data is stored in the database. that is, i would like to access whatever data is entered into a field right after the user pushes the Insert button. I would like to do some processing on the da

  • OS X Safari and Hotmail Certificate Problem

    Hello Apple discussions,I Am having problems accessing part of a microsoft hotmail account which explains below I Have a problem with my hotmail Web account Using OS X 10.6.4 Safari 5.0 when I Try adding another email account to my hotmail account wh

  • Adobe pdf files not saving

    Since transfering my program to Win8, I have been unable to get my Adobe pdf documents to save. They just disappear after naming them. How can I fix this?