4 External TTL signals, variable upto 4Khz (2 on 'Dev1', 2 on 'Dev2') All on gate connections 1 External TTL ‘base’ signal, variable upto 450Khz on gate0 of ‘Dev1’ 1 External Trigger signal on Sorce2 ‘Dev3’
I have been trying to write a vi to calculate phase shift between the 4 TTL signals with reference to the ‘base’ signal without much success.
The 4 TTL signals above are proportional to the ‘base’ signal, but do have slight phase shift between each other and with respect to the ‘base’ signal, which is what I want to calculate. The trigger signal is used to start the samples simultaneously.
Initially I tried to sample the frequency of all five channels and then calculate the error – no joy. I now believe the best way to do this is to count the number of edges on the base signal that occur for every ‘period’ on each of the gate signals. i.e. to end up with an array of 4 columns with 30 rows each with a number of ‘base’ edge counts. I can then calculate the positive or negative shift.
I have used four counter tasks to try to achieve this but can’t get it working. The trouble is that Labview gives me an error that the counter is already reserved (I believe from the first task). I have tried to use the ‘DAQmx export signal’ vi to export the ‘base’ clock of gate0 Dev1 to a RTSI line to make the signal available to all counters, again with no joy. Please see attached snippet.
Is it possible to do this, and if so is this the best way to achieve what I’m trying to do?
Any help and suggestions would be greatly appreciated!!!!!
It is definitely possible to share signals across multiple counters. From first glance at your .doc file, it looks like you're trying to use the same counter for both of your counter tasks. This would give you a reservation error (-50103, I believe). It sounds like the method you have in mind will work for you. I'm not sure which phase differences you are trying to measure, but you might want to take a look at "two edge signal separation" measurement, which allows you to determine the difference in time between edges of two different signals. I'm not sure if it'll help you out, but it's a possibility.
I have spent some more time today trying to sort the problem and basically the first thing i'm trying to do is count the number of edges on the base signal between each edge for the four gate signals, so that I end up with 4 individual edge counts for the four gate signals. The four numbers are then related to the 'base' signal. Again had lots of trouble so tried just one gate to count the number of edges on the base signal. I couldn't even get this to work! I setup a DAQmx task/channel with a property node so that I can hopefully reference whichever PFI line I like for the counter gate and source, but all I can set is 'counterinput' !!!, not gate and source as I thought.