09-21-2009 08:45 AM
I am using the Basic Serial Write and Read.vi from the examples code with a Keyence LC2400 Laser Displacement Sensor, and I want to have a waveform chart continuously plot the output. My question is where and how do I wire the chart into the block diagram?
(I am an undergrad and my only programming knowledge is limited to writing a few lines of C++. This is my first time using LabVIEW)
09-21-2009 08:51 AM
You will have to convert the string you get into a numeric. How you do that will depend on how the string is formatted. If you can capture a string, post that for additional help.
For learning LabVIEW, there are some free tutorials.
p.s. The example you are using is not really intended to be called over and over since it's not necessary to open and close the serial port repeatedly.
09-21-2009 09:11 AM
Thank you for the link and the help!
Since this is not supposed to be called over and over, is there a different way that you would suggest to do this? Our overall goal is to have the sensor continuously check the displacement and we want to read and record the displacement over time.
09-21-2009 09:14 AM
09-21-2009 09:52 AM
The basic structure for Labview hardware I/O is:
Open --> Configure --> Access --> Close
(some may steps may be omitted/combined, depending on the device)
Examples usually just implement this chain for whatever hardware you're talking to (from serial ports to DMMs to scopes).
To do this over and over again, you *could* stick all of that in a FOR loop (ex: calling the example over and over), but that would be much more time consuming than you need. The "correct"/easyway to do it is to put your loop around the "Access" portion (Read or Write, for serial ports):
Open --> Configure --> Access --> Access --> ..... --> Access --> Access --> Close
The link that Dennis provided has an excellent short course called "LabVIEW Introduction - Three-Hour Courseware" which has exercises using your sound card as an instrument (which, although very different from a serial port, still goes through the same Open/Configure/Access/Close motions).
Once you have the process down for one instrument, you can apply the same ideas to just about everything 🙂
09-21-2009 12:04 PM