LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delayed input reading and plotting

Hello,

 

I have a VI in which I type lot of ASCII characters and after a certain conversion I plot those values in a graph. I have a requirement in which I have to plot it when I am simultaneously typing the values as in it should be dynamic and should plot after it reads every 2 bits. I understand that a loop is needed and a clock for delayed reading but I am not able to put them together. Can someone help me?

 

Thanks in Advance

0 Kudos
Message 1 of 7
(3,060 Views)

what do you mean after reading two bits.

 

You adding in the string control ASCII character( are you adding the numbers from 1 to 10 ) and after you have added two numbers, you want to plot them on the graph?

0 Kudos
Message 2 of 7
(3,045 Views)

No what i meant to say is that every 2 bits is a timer value which i convert it to get a distance value and i will plot that against time.So i keep typing random ASCII values and i will convert them to give a plot.i need to this simultanoeusly so that i can show a dynamic plot.

So this means that as soon as i start typing - 2 bits - one point in the graph . next 2 bits another point and that also in the graph so like this as i keep typing a form a plotl.

Hope that simplifies my query!!

0 Kudos
Message 3 of 7
(3,029 Views)

Simon,

 

It is still not clear what you are trying to do.

 

The for loop generates an array of 100 points of linearly increasing values. (X Array)

 

The ASCII section generates an array which depends on how many characters are in the string. There is nothing about bits in there.  The ASCII string is converted to an array of bytes which is then decimated into two arrays of bytes (if the string has at least two characters).  If the string has an odd length, the last character will be lost.

 

If the string is shorter than 200 characters, not all of the X Array points will be used to create the Y Array.  If it is longer than that, not all the ASCII data will be used.

 

You probably want a while loop, a chart rather than a graph, and ... not sure what else.

 

Lynn

0 Kudos
Message 4 of 7
(3,024 Views)

Hi lynn,

 

Thank you for looking at my problem.Yes you are right.the last odd character will be lost and the for loop generates only 100 values.Well i have just posted a part of the main VI.The ASCII string will not be manually entered but will be sent by a device so it will generate a pair of ASCII characters every time unit so there wont be any odd no. of characters.and about more than 200 characters i am not sure cause i did not write and try it out.

For every 2 characters i generate a point that gets appended in the array as one value.Then i plot that point against time(given by the for loop).

The present VI that i have works when i type lot of ASCII characters (even) then when i run it i will have a graph.I require this to be in a loop so that instead of pre written characters i should be able to write the characters during run time(that is the case when the device is transmitting values continuosly) and then the conversion should take place after i write every 2 characters.

Sorry this is a bit long explanation but i hope it is clear enough.

Thanks

0 Kudos
Message 5 of 7
(3,012 Views)

Hi Simon,

 

I hope you learned one of the rules when posting in this forum: provide links to other threads when you continue a discussion started somewhere else!

 

Now Lynn had to analyze code that is based on your questions in your other thread - just unnecessary...

 

For your question:

You should use a buffer for your serial communication data. When new data arrive you can convert that to new points in your plot...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(3,010 Views)

Hello GerdW

 

Thnak you for replying.I will remember to provide links if i am starting a new post for a discussion done in the past.

 

I will try out your solution.

 

 

0 Kudos
Message 7 of 7
(3,008 Views)