03-18-2009 12:20 PM
That was easier, only had to put a "flush buffer" in a sequence structure, in the same part I configured the initial values and that's it, only that I have to be out of the while I have in the other part of the sequence, but that's not a big problem.
Another question I have. How can I make a boolean from a number or a string? It's for example to light a LED when there's data through a wire.
03-18-2009 01:35 PM
There are several ways.. Wish I had LV installed here, I could whip up some examples..
An easy trick is to simply wire to an EQUAL.. for instance a number 1 = 1 gives you a TRUE. Same for string "1" = "1" is TRUE (boolean 1).
03-19-2009 02:47 AM
03-19-2009 07:16 AM
Not if you make value 1 default. It will take any value other than 0 which is the other case.
The "default" case is the "catch all" case for what the other cases do not cover.
It works fine, try it.. 😉
03-19-2009 10:05 AM
03-19-2009 10:48 AM - edited 03-19-2009 10:48 AM
I had to read my post again to make sure I didn't put quotes around the 1 (ie "1" ).. I didn't ... 😉
Okay.. you didn't get it..
Look at the image below:
If you implemented this already, then you should have seen that it works.
The other case (not shown) is 0 (zero). That means it executes the other case if there is nothing at the port, thus the bytes at port = 0. And there are no VISA Read in that case because there is nothing to read.
However, if there are any amounts of bytes at the port, then it will go to the case shown above. Not only for the value of 1, but for any non-zero value. So the case shown above will read whatever amount of bytes is reported by the property "Bytes at Port". If it is 1 byte, then it will read 1 byte. If it is 1234 bytes, then it will read 1234 bytes.
That is why I suggested using this method instead of hardcoding a large value to the VISA Read.
R
03-19-2009 10:52 AM - edited 03-19-2009 10:53 AM
03-19-2009 10:53 AM
03-19-2009 10:54 AM - edited 03-19-2009 10:55 AM
Oh.. then you could place a boolean TRUE in the default case (1) and a boolean FALSE in the zero (0) case. The wire from those could go to your LED.
Sorry for misunderstanding.
R
PS: You do realize that your LED might blink like crazy depending on how fast data gets into the buffer. Not unlike the LED's on an Ethernet Port. 😉
03-19-2009 10:56 AM