04-20-2012 01:26 AM
Hi
I am reading values from an ultrasonic sensor serially using VISA from a microconroller.The values are of the time that the signal takes to travel from and to the sensor and is in ASCII say 22223333 and so on giving 2 bits in 0.5 sec continously.I created a VI where i take the first 2 bits 22 and convert to hex 32 32 and using a subset i give offset of 4 and then convert this to decimal so that i can put the formula to calculate the distance travelled.The conversion works but the problem is after first two bits 22 i want to keep calculating for the other bits continously and plot it in a graph.Eg. for 2233 first 22 gives 0.5 m then for 33 gives 0.6 m and so on..Can anyone suggest ideas as to how i should keep reading from the ASCII string and keep calculating and plotting aswell??
Thanks in advance
04-20-2012 01:32 AM
Please attach your VI instead of a picture. for example we cannot tell the datatpye of your diagram constants. Also whatever you are doing looks highly convoluted.
In any case, you need to put this in a loop for continuous reading.
04-20-2012 01:39 AM
I did try putting it in a loop but i am missing something.i'll attatch both vis.please have a look.
Thank you
04-20-2012 02:31 AM
04-20-2012 03:09 AM
Yes you are right its 0.53 and 0.54 , i just din remeber the answers coz i did this in my lab and nt at home.The speed of signal is 330m/s so i'm just using D=S*T and by 2 coz its the time for a round trip.The formua is rite trust me.And this is just for the first 2 bits what should i do for the remaining??And i figured that i might have to use arrays to save the answers if i am to plot in a graph.Could you send me a vi instead of the image pls.
Thank you
P.S i've seen many solutions of yours and i must tell you are amazing ![]()
04-20-2012 03:14 AM - edited 04-20-2012 03:15 AM
Hi Simon,
that "image" is actually a snippet, you can use it in LabVIEW. (Just search the help for "snippet".)
Btw. English isn't my first language, so reading your message is really hard with all those abbrevations and 'slang'. Could you please write proper English?
04-20-2012 04:13 AM
Hi GerdW
i tried out your code and its perfect i must say thank you.If i need to plot this in graph with x axis as time and y axis as amplitude what should i do?I simply gave a clock and the result into the XY graph but it did not work.And if i am using the serial read-write VI and i constantly get values while reading, will your code work for simultaneous conversion??
04-20-2012 04:49 AM
Hi GerdW
I am attatching the the serail read write VI along with your code.I just wanted to know that when i am constantly reading values from the sensor will i be able to plot it simultaneously aswell ??
Thank you