LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data logging error

Solved!
Go to solution

Hi,

 

I am currently new to labview. I try to create some data logging for PIC through serial com. The data will log the voltage of the potentiometer connected to the PIC. Apparently, sometimes, i get accurate reading and sometimes, i get junk data. I hope someone can help 🙂 Thanks in advance.

0 Kudos
Message 1 of 13
(2,912 Views)

You didn't give us much information to work with there.

 

What are the "junk readings" you are getting?  How does it compare to the real readings?  Give us some concrete examples.

 

Why do you have an Allow Transmit property node in there which you never use?

0 Kudos
Message 2 of 13
(2,907 Views)

The junk readings are sometimes 0, 46, 0.346, 236 while my UART is sending 2.346V. I am not sure how to set the property 🙂 It is originally no of bytes at port

0 Kudos
Message 3 of 13
(2,896 Views)

You must be missing bytes in some way or another.  You'll have to put a probe or indicator on the string wire coming out of the VISA read to see what the string data actually looks like.

 

I don't know what you mean by "I am not sure how to set the property 🙂 It is originally no of bytes at port."  You shouldn't need to read the Number of bytes at port if you are using a VISA read of 10 bytes and have enabled the termination character.  Is your data ever longer than 10 bytes?  If so, increase the number of bytes you are trying to read so that you always get your termination character to determine when the read ends.

0 Kudos
Message 4 of 13
(2,893 Views)

I currently get 2.346V at visa read, but going through a fract/exponential string converts it to 0.00. My intention is to display the numbers in the string in graph. 

0 Kudos
Message 5 of 13
(2,889 Views)

Show the indicator on the VISA read string with either \code or hex display turned on.  There must be some other character in there that you can't see that is corrupting the conversion.

0 Kudos
Message 6 of 13
(2,887 Views)

Just found out the problem. I included ADC = 2.341V in the string. It has problems as i didnt extract the numbers  out. may i know what can i do to extract the 2.341 out? thanks for your guide. 🙂

0 Kudos
Message 7 of 13
(2,881 Views)
Solution
Accepted by topic author ZHENNING

Try using Scan from String function with the format string being    ADC = %f

0 Kudos
Message 8 of 13
(2,879 Views)

Yup. Its working. Thanks!!! 🙂 By the way, how to scan for changes in the uart line? that is i sent 2.346V then it is displayed correctly now. Then i change my ADC to 5V, but labview visa read still on 2.346V. I hope to hear from you soon. Thank you very much for all the guides 🙂

0 Kudos
Message 9 of 13
(2,872 Views)

Are you sure your device is sending out the new value on the serial port?

 

Is it possible that it is sending data faster than you are reading it?  You have a 100 msec wait in your VI.  Could you be slowly filling up the serial buffer that when you make the change to the voltage, your VI is still reading old data that is in the serial port buffer?

0 Kudos
Message 10 of 13
(2,854 Views)