07-15-2024 02:34 AM - edited 07-15-2024 02:34 AM
Greetings!
I have an input stream of an array[2] of U32 coming from a FIFO which is being serially converted and written to another FIFO of U32 datatype, one element at a time. I would like to expand my data bus to an input array[8] of U32 (increasing the no. of elements to 8 from 2). But I am unable to figure how to serially convert it and then write it element by element.
The Expand Pulse sub VI simply expands the impulse to ensure that it gives 2 valid bits when the input to it is changed from 'T' to 'F', ensuring that both elements of the array can be written to the new FIFO. I have already expanded this logic to give me a pulse of 8 valid bits. Here's the ExpandPulse2 Sub VI:
And here's the 8 bit version of it:
Solved! Go to Solution.
07-15-2024 08:58 AM
I have implemented it by reading the first element and then rotating the array (i.e to delete the first element and append it at the end of the array) over 8 iterations. Here's a snapshot of it, if anyone else is able to come up with a better solution, feel free to post it.
07-15-2024 09:13 AM
That array rotating sounds utterly inefficient. Why not just incrementing an index in a feedback node that is then applied to the Index Array Element without the loop?
Also it all feels a bit asynchronous. Are you sure there is not a new VI::DDC_IQ array coming in before the 8 VI::DDQ_IQ_U32 elements have been generated?
07-15-2024 09:45 AM
I'm really not understanding what you are trying to do here. In the end, your code is just sending the last element. If you are trying to send all of the elements one at a time, then your FIFO Write should be inside of a FOR loop using the autoindexing tunnel for the element to write.
07-16-2024 12:27 AM
@rolfk wrote:
That array rotating sounds utterly inefficient. Why not just incrementing an index in a feedback node that is then applied to the Index Array Element without the loop?
Thank you, sir! I'm not sure why my brain couldn't come up with that, it's more efficient. I have implemented it with a counter which resets the index when it reaches 8 and it works perfectly!
@rolfk wrote:Also it all feels a bit asynchronous. Are you sure there is not a new VI::DDC_IQ array coming in before the 8 VI::DDQ_IQ_U32 elements have been generated?
Yes, no new array will be coming in unless all of the previous 8 samples have been read, the handshake ensure that.
07-16-2024 12:38 AM
@crossrulz wrote:
I'm really not understanding what you are trying to do here. In the end, your code is just sending the last element. If you are trying to send all of the elements one at a time, then your FIFO Write should be inside of a FOR loop using the autoindexing tunnel for the element to write.
I wanted to read the 8 samples from the first FIFO and then write them one at a time into a new FIFO (sort of converting it from parallel into serial). I suppose putting the FIFO in FOR loop works as well. Thank you for your reply!