LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Most efficient to combine arrays

I am using high speed USB module, produced by FTDI (UM232H).  I am not using RS232 to USB converter, it is strictly USB protocol.  I kinda of explained some of this stuff in message 14.

 

pjr1121, I probed the data coming from my read buffer and this data is not increasing in size.  However you are right the increase in size comes from the shift register I have.  I am not sure if you would have an idea of how to fix this. 

 

I am not sure if you read message 14 where I try to explain the scope of my project.

0 Kudos
Message 21 of 24
(634 Views)

Yes.  I did read message 14.  But just because it is a "high speed" module doesn't automatically mean that you are forced to use a .dll mode of communication and that a more user friendly VISA/serial port method of communication doesn't exist.  That is a piece of information that you did not include in your post and we can't read your mind.

 

As I said, you are going to be the one who needs to apply the available debugging tools to solve your problem.

0 Kudos
Message 22 of 24
(622 Views)

Sorry, I should have stated that the communication I am using is USB 2.0 high speed.  Also the reason why I am using a .dll for communcation is because in order to communicate with my hardware it requires the use of special drivers (D2XX driver) and these .dll are provided by the company (FTDI) from whom I purchased the module from.

0 Kudos
Message 23 of 24
(610 Views)

If what you want to do is to create a circular buffer of a particular size, there are two ways I can think of to do this, one "easy" and one "hard".

 

The "hard" way is to (a) create an array (Initialize Array) the size of your buffer, set your "input pointer" to 0, then as values come in (one at a time, in this example), replace the "index pointer" value with the new value, and increment the index pointer modulo the array size (do this in two steps -- the first is a simple Increment, the second is the Quotient/Remainder function, with the Array Size as the divisor).  Keep all of these things in a Shift Register, of course.

 

That puts data into the array.  To take data out of the array, you simply need another pointer (which you also increment modulo the Array Size) and use it to Index Array.  You might want to test that your Output Pointer never passes your Input Pointer (if it catches up, then you've read and processed all of the points).

 

The "easy" way to do this is to use a Lossy Queue (which I'm sure NI implements as a Circular Buffer internally).  Create the Queue having the size of your buffer.  As data come in, simply do a Lossy Enqueue Element, and to get the data out, simply Dequeue Element.  The Dequeue will "block" when all of the elements have been processed, and the Lossy Enqueue will simply overwrite older elements (including elements that haven't yet been processed!).  If your data can fit the Queue model, this is much the simpler (and less error-prone) way to do this.

 

Bob Schor

0 Kudos
Message 24 of 24
(573 Views)