02-17-2011 10:54 PM
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?
02-18-2011 01:58 AM - edited 02-18-2011 01:59 AM
Well, by now you should have enough information to do all that. 🙂
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! 🙂
How much data are we talking about here? How big does the table typically get?
02-18-2011 03:07 AM
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?
02-18-2011 11:09 AM
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?
02-18-2011 12:38 PM
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
02-18-2011 12:41 PM
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.)
02-18-2011 01:14 PM
how do i make the read string to be my input?i try it but didnt work..can u help me
02-18-2011 01:27 PM
Quick and dirty solution:
Can we assume that the size of the received string is quantized into multiples of four bytes? In this case:
02-18-2011 01:41 PM
is this one correct?what do u mean by the loop on the left also needs a small wait?
02-18-2011 04:58 PM - edited 02-18-2011 04:59 PM
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.