Showing results for 
Search instead for 
Did you mean: 

How to produce a shift register which uses a delayed input signal

I am trying to produce a vi which mimics a neutron correltiaon shift register.
I have managed to write half of this which uses a shift register to correlate input signals with each other (the real+accidental signal).
However I would now like to add a extra part to this vi which after a predetermined delay from the input signals dumps the contents of the shift register to a scalar (the accidental signal).
My current vi is based upon a single while loop and currently using a simple switch to produce the input signals. 
I am finding this difficult as when I include the delay required this effectively slows down the whole loop.  Does anybody have any ideas on this topic?
Many thanks in advance for any help,
Nigel Smiley Happy
0 Kudos
Message 1 of 10

I thought I would add to the above after doing some more work and investigation into my vi.

I found that one of my problems was that the wait function that I was using was actually a RT module and therefore when using several of these the whole vi was being delayed by the sum of all the wait functions.

However, now that I have solved this I have hit another problem.  I have managed to produce a shift register within a while loop which dumps the total correlations contained within it if more than one input is detected within the shift register.  This appears to work as I would like it to but requires the use of 64 shift registers which are then bundled into a cluster.  My first query is if anyone knows of a more efficient way of doing this, maybe through the use of an array?

In addition to this I also want to dump the value contained within the shift register at a predetermined delay after the input signal has been detected.  I am unsure how to do this as I have attempted simply adding a wait function but this then means any inputs received during this wait time go undetected.

I have attached a doc containing the circuit which I am trying to create, it is the long delay strobe which I am now struggling with.



0 Kudos
Message 2 of 10
Hi Nigle,

Could you attach your code.  It sounds like you are not far off.  If it is just a timing issue, I'm sure we can easily sort it out.

Look forward to hearing from you.


Seamus C
0 Kudos
Message 3 of 10

Here is my current vi - the one that is not working correctly, plus a screen shot of it.

As mentioned previously I have managed to get the R+A shift register working correctly but am now struggling with the delayed strobe part which should take the input signal and delay it by a set time then use it as the strobe to dumpthe contents of the SR - the problem I dont seemto be able to get around is by delaying the signal I throw away any inpuut signals recieved during the time period of the delay!  Therefore I think a second shift register is required but due to the delay needing to be considerably longer then the length of the initial shift register this would make the second SR very large >1000 entries!!!

Any help is greatly apreciated.



Download All
0 Kudos
Message 4 of 10
Just take a look at your program. In fact, I do not know what is your problem (the problem you state, may be my english is bad) but I think about the shifting of the data I think there should be a better way of doing this instead using so many icons. you take a look at the vi I attached.
(also attached the jpg block diagram just in case, if u dont have lv8)
When you feel sad, laugh
Download All
Message 5 of 10

Many thanks for the reply nayisoe that has really helped to simplify my vi. 

Although now that I am using an array is there an easy way to sum all the elements in the array together, i.e. if I have a 10 elements array with 3 elements being equal to 1 and all the others being 0 how can I get the resulting sum (3) out of this array.  Sorry if this is a stupid question but I am still very new to all this.

Many thanks again,


0 Kudos
Message 6 of 10

Hi Nige K

Use Add Array Elements found in the Numeric Palette


Message 7 of 10
Hello again,
Thanks for all the great input I have now managed to produce a VI which does what I want.
Unfortunately I have now moved on to the next development step where I want to use the signal from my detector as the input, at first I thought this would be trivial but due to the time resolution that I want it is proving to be very troublesome.
I require the while loop to execute at least once pre micro second so I thought I would use the FPGA on the PXI-7811R.  This seemed fine until the fact that several of the pallette items that I needed are no longer available i.e. add Array Elements and only 1D arrays are allowed.  I believe I have managed to get around this problem through the use of clusters, please see the attached VI and jpg.  I realise that this is no longer a nice neat solution but at the moment I just want to get it working!
My problem now is that I have tried to compile this vi on the FPGA and it has currently taken >100hours and has still not finished.
Therefore I would like to ask if anyone has encountered these problems before and if so how did you solve it and linkedto this is there a more efficient way of producing my VI to cut down on the compilation time.  I believe the problem is caused by the large array (1024 elements) but I cannot think of another way of achieving my goal of delaying ALL incoming pulses by 1024microseconds without losing any data???
Any help and suggestions are greatly appreciated,
Download All
0 Kudos
Message 8 of 10

Hello again,

I am still struggling with the above but do believe that it should be possible if I can substitute the arrays for FIFOs?  Does anyone know if this is correct and is so is there an example of a FIFO vi which replicates the operation of a large shift register?

Thanks again for any help,



0 Kudos
Message 9 of 10

The secondary question asked in this forum relating to substitution the arrays by FIFOs is duplicated on the following forum:

Could any further discussion relating to this be continued on the other forum string to avoid complicating this thread.

It's makes information more easily accessible if each thread only contains a single disscussion and ensures other looking for the same information can find it.

Many Thanks

Emma Rogulska

NI UK & Ireland

0 Kudos
Message 10 of 10