From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

circular buffer

None of that requires a circular buffer for the string data. If you find that you cannot keep up, then use a producer/consumer architecture like shown in. the templates.
0 Kudos
Message 11 of 18
(815 Views)

if you can tell me about the packet format you are using , i can give you better suggestions. What information i need is "does your packet is of fixed length or variable length"?

however in either case most probably you wont be requiring circuilar buffer.

.

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 12 of 18
(795 Views)

i think that is the problem, there is no packet size.  Teh data is continuosly being streamed to the computer.

0 Kudos
Message 13 of 18
(789 Views)

let me put my question in different words.

 

what should be the parsing logic for comand.

OR

can you put some recorded stream data coming on port. and then may be describe it.

Tushar Jambhekar
tushar@jambhekar.com

Jambhekar Automation Solutions
LabVIEW Consultancy, LabVIEW Training
Rent a LabVIEW Developer, My Blog

0 Kudos
Message 14 of 18
(787 Views)

Well there are 2 analog boards and 4 channels on each board.  The data from each board is 16 bits.  There is a delimiter in front of each channel to identify the data from each channel.  When the data is being streamed to the computer, first the delimiter must be identified and then the string will be broken up into a substring with length 2 (to represent 16 bits from each channel).  I have no problem decoding the data, my biggest worries is to try and display real time data, while still ensuring that there is not data overflow and preventing a lost of information.  That is why I thought that the circular buffer might helped in this situation. 

0 Kudos
Message 15 of 18
(785 Views)

kevin,

 

Generally the best way to avoid data loss from a streaming source is to use parallel loops.  One loop reads the data and puts it into a queue.  The second loop pulls data from the queue and decodes, analyzes, displays, saves, ... whatever.. The second loop can run much slower so long as it can remove the data from the queue fast enough to avoid memory overflow.

 

Look at the Producer/Consumer (Data) Design Pattern which comes with LV.

 

Lynn

0 Kudos
Message 16 of 18
(776 Views)

Hi there

 

Okay so i have implemented a queue in my program, where I will read the data in one loop and then have a second loop that will decode the data.  However the I have a new problem.  The queue for the decoding loop does not seem to reach the loop or does not enter the loop.  I have attached my VI and I am worrying if someone could look it over and tell me if I am doing something wrong or what might be causing this problem.

0 Kudos
Message 17 of 18
(766 Views)

There is actually very little that is correct in your program. The major problem is that you have created a data dependency between loop 1 and loop2 because you've wired the error out/VISA ref from loop 1 to loop 2. Therefore. loop 2 cannot start until loop 1 finishes.

 

You really need to do a lot of cleanup. You could just have an event structure in the top loop where you do a read in a timeout event. Add labels for the controls you have in the event structure. The stop button should stop the loop. Do NOT use the LabVIEW Stop function anywhere in your code.

 

You can use a single case statement in your bottom loop. No need for all of those silly equal to comparisons. You can wire a string directly to the selector.

 

I don't understand what you are attempting with the feedback node. It looks like you are continually initializing it.

 

Look closer at the producer/consumer example. There is a lot you are missing.

0 Kudos
Message 18 of 18
(760 Views)