05-07-2005 06:44 PM
05-08-2005
05:51 AM
- last edited on
04-27-2025
12:43 PM
by
Content Cleaner
it seems like this vi waits for the programmed amount of time then displays the read buffer. I need to be able to communicate with the device that is talking to the serial port. IE always be waiting and receiving data until something is received then write something back then receive again. Also I'm not always sure how many bytes may be sent by the device.
The serial read VI tries to read X bytes from the serial buffer, and if it doesn't find X bytes, it waits until the timeout set using the VISA Configure VI expires, then returns with a timeout error. If you're not receiveing on a regular basis, you can use the Bytes at Serial Port property (which is located on the serial palette) to detect if you have data waiting by placing it inside a while loop and using comparison function to stop the loop.
You can respond by using the VISA Write VI which can also be found in the serial palette. Just wire the VISA Resource name and\or error terminals from the read to the write to force the write to happen after the read. There are also several other ways to do this. You can select how to respond by using a case structure.
This is the string I receive "999999999999" Can it be displayed as hex instead of ascii?
Do you want to display the ascii values in hex or do you want to display the numeric value (9999)? For the first you can simply right click the string indicator and select Hex Display. For the second, you will need to identify each block (apparently starting and ending with 144 ascii) and use the string functions to extract the number and then convert it to a hex number.
To learn more, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with and here is another. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide.
05-08-2005 01:34 PM
05-25-2005 09:51 AM