LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to sample data every two points in LabVIEW FPGA

Solved!
Go to solution

Hello everyone, 

Now I want to use the High throughput math function to do calculation. The function I used is Arctan(x/y), which has 2 input ports, x and y. My block diagram as follows:

011.JPG

The data comes is the sampled sine wave data, the sample rate is 4 times of sine wave frequency. So I can get 4 samples every sine wave period, it is called I Q sampling. Let's say the data comes is like 1,2,3,4,1,2,3,4,1,2,3,4..... What I want is either (1,2) or (3,4) as (Y,X), and abandon points (2,3) and (4,1). 

As what shown on the picture, I used a feedback node linked to Y as a latency. So in the first cycle, (Y,X) will be (1,2). In the second cycle, (Y,X) will be (2,3). This is not what I want. 

So is there any good way to solve this problem? 

Thank you. 

 

0 Kudos
Message 1 of 7
(2,853 Views)

The simplest solution would be use a case structure so that the math is done every  second cycle.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(2,845 Views)

Could you please explain it more specifically? How to write functions in case structure? 

Thanks

0 Kudos
Message 3 of 7
(2,837 Views)

Can't you just toggle the input valid input of your ATN function to control when to perform the operation or not?

0 Kudos
Message 4 of 7
(2,795 Views)

Hi, thanks for replying. 

I try to do it on the input valid port, but don't have a good way to solve it.. Do you have any good ideas?

0 Kudos
Message 5 of 7
(2,778 Views)

I assume you have your channel counter somewhere, maybe counting 0..3 (for channels 1..4). Then you could just extract the lower bit and wire it to input valid. The lower bit will be T if the counter is odd (1, 3).

Message 6 of 7
(2,774 Views)
Solution
Accepted by topic author zyb1003

A simple shift register that holds a boolean and you just invert (NOT) each iteration would do the job.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 7 of 7
(2,762 Views)