LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA Memory blocks : How to time memory block read ?

Solved!
Go to solution

Hello,

 

I want to read arbritary waveforms with different frequencies.

I have 25000 points memory block i read to set FPGA AO values.

 

My question is :

Does a "Wait function" can handle the diffrent frequency i want data to be played ?

Are there better ways to get precisely timming reading memory blocks ?

 

Vincent

0 Kudos
Message 1 of 9
(3,921 Views)

Instead of changing the ticks rate (how often you read your Memory or Look-Up-Table) consider reading at full speed but change the address increment depending on the 'frequency' you want to output.

 

So if you read your 25000 memory elements sequentially with an address increment of N you'll get a waveform that is N time faster than if you increment your address by 1 (there are Nyquist consideration to be aware of). The good thing about this approach is that your N can be of any value integer or not. If N is an integer number you can read your memory element value and use it directly. If N is a floating point value you'll have to use linear interpolation to find your sample value using the two consecutive memory element values located at integer addresses nearest N. 

0 Kudos
Message 2 of 9
(3,892 Views)

Thank you LocalDSP for your feedback.

 

Your idea is great and i am already using it to generate periodic signals indeed. My 25000 points are random so it can't applies.

So far i just consider the wait function to do it, but i am not sure that's the better idea.


Vincent

0 Kudos
Message 3 of 9
(3,885 Views)

Can you post more information about what you are doing right now? Best would be the actual VI with pre-configured memory (use eventually a LUT). Looking at your 'random' data would help understanding what you try to achieve.

0 Kudos
Message 4 of 9
(3,880 Views)

I cannot share my code but if you really want an example i could make one later. Anyway that's not the issue.

Our random data is close to white noise. It is not a periodic signal.

You can imagine the code

* while loop(with shift register accumulator increment for sinus generation)

* a cmd cluster

* a case structure with (None, sinus, arbritary, constant, ...)

* I/O item

and a target scoped FIFO to send then data to host.

 

Today i will read memory block full speed (1Mhz). I want to find a clean way to handle that frequency.

Vincent

0 Kudos
Message 5 of 9
(3,877 Views)

Here is the signal shape on the first 1000 points

Vincent

0 Kudos
Message 6 of 9
(3,872 Views)

At the end there are only two parameters you can play with and combine.

- read speed, so for example if your ticks is 25 ns (40 MHz) you can define any multiple of that ticks value (assuming you still respect the minimum requirements - like 1 us or 1 MS/s) even on-the-fly.

- address increment: as you mention mainly for periodic signals.

 

So depending on your signal type and what you are trying to achieve you can use either one, or both, to control your 'frequency'. I would suggest to play with the timer value (ticks) rather than adding Wait to delay your read/AO operations.

 

Also it depends on whether your are using a single-cycle-loop or a regular while loop in your application.

Message 7 of 9
(3,868 Views)
Solution
Accepted by topic author Vincent90

Attached what i code to do it. I think that's indeed better than a wait function !

Any hints on a way to improve this ?

 

BR,

Vincent

0 Kudos
Message 8 of 9
(3,859 Views)

Hello Vincent90,

 

Your VI seems to be pretty efficient. Congrats.

 

Best regards.

0 Kudos
Message 9 of 9
(3,811 Views)