11-23-2009 07:40 AM
Hi,
Im trying to set up a data acquisition program in LabView using an optical pen made by STILL, the controller for the sensor transmits data via a serial port. I would like to use the instrument IO assistant to send a trigger command to the controller (in ASKII) and write the data received back to a file. The data received from the controller can be ASKII or binary.
I have set up the instrument io assistant to the point where I can communicate with the controller.
Can anyone give me some pointers as I am fairly new to LabVIEW.
Cheers,
Joe
11-23-2009 07:44 PM
Do you mean ASCII?
What do you mean by the data that comes back can either be ASCII or binary? Any data coming from the serial port is a series of bytes. They can be shown in a string indicator. They would could appear liek a series of characters, symbols or numbers depending on what the display setting of that string indicator is. It is up to you to figure out what you need to do with those characters to turn them into something more meaningful if needed later in the program.
I would recommend you look at the Basic Serial Write and Read VI in the example finder along with other serial port examples there.
11-24-2009 09:54 AM
Thanks for the reply. I have taken a look at the example you recommended, it was very useful. What I would like to do is send a trigger command to my controller via serial eg $TRG, this will prepare the controller for an external trigger, once this external trigger has been sent the controller will start to send data via the serial link, I would like to store this data received.
Do you have any further recommendations?
I mentioned ASCII because I can set the received data to be in ASCII format or binary format, from your reply im guessing I will have translate the series of bytes received into this format to interpret it.
Cheers,
Joe
11-24-2009 10:20 AM
You will probably need some sort of loop around your reading function assuming this is data that will be coming in continuously. You may also have to work out some timeout issues. How long after sending the trigger command could it take until the trigger occurs and data starts to come in? If it takes too long, you will need a mechanism to detect the timeout and get ready to read data again.
Yes, you will probably need to do some conversion from the bytes that come in to some other data structure. There have been numerous threads in the forums asking questions about various types of data conversion. If you get stuck, post back with an example of the bytes that you receive and what you expect them to mean.