LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem to sort data in array

thanks for all replies..i think im not explaining enough on what im doing..sorry for that

 

actually, i want to create vi which will read the data from another program using serial port..means my input here come from another write program

so here im just assign my tags as 1111,2222,3333... but i'll change it after this according to what is needed..for example maybe 00FE,00AF,01FE or something else and definitely it is in hex..then the value for each of this will also come in hex and be sort in the table as a decimal value like what have been done

 

other thing is i want to remove the add button so that every read data will automatically put into the table..this mean if i write continuously and sent it to this vi. it will read the data continuously and update the value in my table until i stop it..is it clear enough?

0 Kudos
Message 11 of 50
(417 Views)

Well, by now you should have enough information to do all that. Smiley Happy

 

Here's a quick draft how you could built the table in a subVI. First we initialize the tags then we generate fake data and write it to the existing table data as it is received. (Note that you can write to, and read form the subVI from different places if needed).

 

It definitely needs work, but should give you some ideas.... Good luck! Smiley Happy

 

How much data are we talking about here? How big does the table typically get?


LabVIEW Champion. It all comes together in GCentral GCentral
Message 12 of 50
(403 Views)

thanks altenbach..i'll keep it as my reference =)

 

for now i use your 1st vi. and make some minor change to it

btw, is there any way to remove the add function so that my input will automatically insert into table as the program run and the input is inserted?

0 Kudos
Message 13 of 50
(394 Views)

How do you know if new data has arrived?

 

You could just change the "add event" to a "timeout event" and read the string from the machine there. How do you interface to the hardware?


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 14 of 50
(377 Views)

my motor controler will send this kind of data continuously through serial port..so i want this vi to grab it and store it accordingly in table continuously too until the program stop

0 Kudos
Message 15 of 50
(369 Views)

So, replace the string controls with your grabber code.

 

(In general, I don't like code that grows data structures without upper bounds. It will ultimately run out of memory.)


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 16 of 50
(365 Views)

how do i make the read string to be my input?i try it but didnt work..can u help me

0 Kudos
Message 17 of 50
(354 Views)

Quick and dirty solution:

 

Can we assume that the size of the received string is quantized into multiples of four bytes? In this case: 

 

 

  • In the loop on the right: Change the event case from "add: value changed" to "input: value changed".
  • In the loop on the left: Delete the "read string" indicator, feedback node, and concatenate function and simply write the string to a singaling value property of the string named "input".
  • The loop on the left also needs a small wait. 

 


LabVIEW Champion. It all comes together in GCentral GCentral
Message 18 of 50
(350 Views)

is this one correct?what do u mean by the loop on the left also needs a small wait?

0 Kudos
Message 19 of 50
(340 Views)

No, not a local variable. A value(sgnl) property node.

 

Your left loop spins millions of times per second, even if it executes the FALSE case, doing nothing but burning CPU cycles. Thus you need a small wait to slow it down to a resonable loop rate and thus allow other processes a fair chance to run too.

 

Most likely you need to buffer the arriving bytes and only hand them to the processing loop in multiples of four. Try it.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 20 of 50
(326 Views)