04-01-2012 05:58 PM
@Baioneta wrote:
That doesn't work, simply because of the 1st question I asked. The visa reader is getting each char at a time, I have to put it all together and then analyze it.
Did you program it like I have shown? It is a snippet so you can drag and drop that image into the block diagram of a blank VI. The VISA read won't be getting each character at a time if you ask for enough characters.
04-01-2012 06:07 PM
I can't run it.
LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
04-01-2012 06:21 PM
That error doesn't make sense.
Here is the VI attached as a .vi file.
04-01-2012 06:22 PM
Now there's a different one
LabVIEW: Scan failed. The input string does not contain data in the expected format.
04-01-2012 06:30 PM
I don't get it, everything looks fine but I can't run it. I checked the serial configurations, the data sizes, ...
04-01-2012 07:06 PM
Done.
Problem solved, maybe it ain't the best solution but it works...
Basically what I did was a function to count the number of lines and then scan the line I want.
04-01-2012 07:20 PM
Instead of continuing to try to force your version of the VI to work which I told you had problems with it, why didn't you actually try to use mine. I told you the bytes at port method was wrong, and it made no sense to continually redefine the termination character on every loop iteration, yet you don't listen.
I'm glad you think you got it working, but in reality there are still so many things wrong and the code is a hack job trying to make it work the way you are trying to do it. It is just a matter of time before something else will occur that keeps it from working and you'll have to hack something else together.
There is no reason for that scan from string error to occur unless you aren't getting the data you think you are getting, or you didn't set the format string correctly. I'm sure that problem would've been solveable if you posted the VI with actual received data, but whatever.
04-01-2012 07:25 PM
Your help was very nice but somehow I couldn't make it work, I'll try to modify those things you said.
I did post the received data, in a picture where you can see the string sent by the mcu.
04-01-2012 07:40 PM
The scan string looks the same in your image as it did in the one I pulled from your VI. So there is no reason for that to cause an error.
I do see data, but it is only a screen shot which makes it impossible to try out in code.
But something doesn't look right in your screen shot. It looks like "tempo" came out as 0, but is 1 in the data. And "tenso" also came out as zero, but looks like it has a value in your data.
Are you sure you aren't getting an error with your VI but disabled automatic error handling?
04-01-2012 07:49 PM
The string is something like this:
!14R448.373V1.548$ 2 0
The first char(!) is the start char
The 2nd and 3rd is the number of chars that will be sent untill ($)
those in orange are R (stands for resistor) and the value of the resistor
those in purple are V (stands for voltage) and the voltage value
$ is the finall char
2 is the seconds between Analogue to digital conversions
0 is the channel of the analogue multiplexer
So this means this values can change all the time, except ! and $
This is the reason why I want to scan the string, to check this values...
The scan string looks the same, but I get those errors, I don't know why