10-17-2016 01:04 PM - edited 10-17-2016 01:10 PM
@DP123 wrote:Hi Raven
The command IDN was already in the example in labview and that is why I just left it there. I actually did not know what it did until you just explained it. So what should I replace it with?
I don't know. This where the point where you have to take the time to Read The Manual.
The reason you are getting a zero is that your response has a space in front of it. Do you remember reading message 20?
10-20-2016 07:31 AM
Hi Raven
Yes, I remember message 20. I just thought that adding a space in my seach string would be a mistake as you told me in message 22?
It is now working properly and the data is being plotted on the chart. Thanks alot to you, crossrulz and the others!
I am still dealing with a problem though. Sometimes when I start reading I get an error message. I tried solving this by increasing the VISA buffer size but I do not think it is helping or I might have done it in a wrong way.
I attached the error message and the VI aswell. Thanks again!
Greetings
DP
10-20-2016 07:41 AM
10-20-2016 07:49 AM - edited 10-20-2016 07:49 AM
Hi Gerd!
How would I know which one give me the error. I guess I could take one of them out and see if I am still getting the error?
How do I fix that? I do not see any other options then using "use default if unwired".
Greetings
DP
10-20-2016 07:54 AM
@DP123 wrote:I am still dealing with a problem though. Sometimes when I start reading I get an error message. I tried solving this by increasing the VISA buffer size but I do not think it is helping or I might have done it in a wrong way.
My guess is because you have the Boolean set to FALSE. Get rid of that button and the case structure around your VISA Read. So what is happening is the instrument is constantly sending data and it is filling up your buffer while you are not read it. If you do not read the data in order to clear out some of the buffer, the buffer will get full. So the next time you do a read, you will get that error. So the solution is simply to always read the data.
10-20-2016 08:08 AM
Hi Crossrulz
It makes perfect sense what you are telling me. There is an LED on the usb that shows if the device is reading data and if I stop the VI from running for a minute it stops flashing. Then when I run the VI again it gives me the error and I guess it is like you said the buffer got filled up.
Greetings
DP
10-20-2016 08:16 AM
Hi DP,
How would I know which one give me the error.
Well, using indicators or probes for DEBUGGING would be a good start - you should have read/heard about this in the beginner tutorials you can get for free on NI's website!
10-20-2016 09:00 AM
@DP123 wrote:Hi Raven
Yes, I remember message 20. I just thought that adding a space in my seach string would be a mistake as you told me in message 22?
I did say it was a mistake adding the space in the search string. It seems that sometimes that space is there and sometimes it is not. So adding the space in the search string means you are going to get errors the other times when the space does not exist in the incoming data.
Read what I said in message 22.
You need to figure out what is going wrong with that space being there or not. And if you can't, then use trim white space on the incoming data to clean it up before you scan it.
10-20-2016 09:10 AM
Hi Raven
It makes sense that I should get an error when the space is not there. The thing is I am not getting any error except the error I get when the buffer is full. How can that be? Like you said I would expect an error.
Greetings
DP
10-20-2016 09:47 AM
Let's reset.
Is it true that you are no longer having errors that are the result of problems with the data coming in and the format string used to scan the data from the string?
Now the problem left to solve is that you sometimes get buffer full error messages?
You said "Sometimes when I start reading I get an error message." What do you define as "start reading"? Is it when the VI starts? Or are you toggling that boolean control while running. If it is stopping and restarting the VI, you shouldn't have a problem because the VI closes the serial port and won't receive in any messages on the wire. If it is leaving the serial port open and you just stop reading, then you will have a problem because the serial port buffer will fill up.
With a device you have no control over as to when and how much data it sends because it is just spewing data continuously, I recommend you close the serial port whenever you are not going to read from it, and reopen the port when you start up again. Be prepared to deal with incomplete messages because you have a possibility of reopening the port in the middle of the transmission of a message.
Or just go ahead and continually read from the serial port and discard the data you don't care about.