03-21-2017 06:15 PM
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:
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.
Solved! Go to Solution.
03-21-2017 06:34 PM
The simplest solution would be use a case structure so that the math is done every second cycle.
03-21-2017 06:44 PM
Could you please explain it more specifically? How to write functions in case structure?
Thanks
03-22-2017 03:59 AM
Can't you just toggle the input valid input of your ATN function to control when to perform the operation or not?
03-22-2017 08:20 AM
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?
03-22-2017 08:30 AM
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).
03-22-2017 09:07 AM
A simple shift register that holds a boolean and you just invert (NOT) each iteration would do the job.