09-15-2023 12:33 PM
Hi,
I am trying to extract the digital data from a distance-measuring laser (Acuity, Model: AS2100) through serial RS-232 to USB communication from within Labview, but I cannot get it to work. I would like to read the data directly and store it in a text file with the data converted to mm distance and the interval of recording can be every 10s or something that i can adjust later on. I want to be able to turn the laser on and off to start recording and stop recording.
I also have a python script provided from the manufacturer which i was thinking i could perhaps call from within labview, i could post the script. Which method would be simpler or better?
The reason i am using Labview and not directly python, is because the laser is just one of the instruments/equipment (load cell, tilt sensor and a winch) connected to the bigger main code written in labview. Hence, here is just the laser portion that I'm trying to test separately to ensure everything works correctly before i can integrate with the rest of the code.
I will provide my first initial code test for serial communication rs-232 with the laser, the error I received and also the manual.
Thanks in advance.
09-15-2023 04:32 PM - edited 09-15-2023 04:33 PM
The python implementation is very clear and neat.
Now, to your question to use with LabVIEW, one can reimplement the commands based on Python implementation or based on the manual. If you don't want to spend too much time to understand the individual commands, you can blindly translate the Python class into an equivalent LabVIEW class and call it a day.
Unfortunately, you're nowhere close to the code required to get measurements. For your device, to measure, you need to send a command, read the response, decode it and calculate the measurements.
And your serial configuration does not match the one in Python, this would the equivalent based on the python code.
09-15-2023 07:03 PM
hello santo_13,
thanks for your reply.
the python code is an example and also the first part of the code sets up the configuration of the device which can also be handled by the software of the laser provided by the manufacturer and the configuration is directly downloaded to the laser, and so the bottom portion of the code is an example of the communication with the laser and to extract data.
i understand that an option would be as you said to translate the portion of the code needed to extract the data in labview using labview class perhaps which i am not certain from where to begin.
is it possible to read a python script from within labview and continue the rest of the code in labview as the rest of my code for the other instruments are written in labview.
the code i posted was a basic code from how i saw online how to communicate with serial using rs232 in labview to read in data, but yes my config should have been to set to default.
i am not sure from where to begin and any guide would be much appreciated. i am relatively beginner to labview.
thanks for your support.