12-09-2019 10:39 AM - edited 12-09-2019 10:42 AM
1. Again, what you are showing does not reflect the manual you gave us. Are you sure you have the right manual?
2. Do NOT use Local Variables here. They do nothing but add confusion and race conditions. Use wires!
3. You have an infinite loop. Stop using the Abort button in the toolbar to stop your VIs. Initialize you port before the loop, close it after the loop, and use a stop control to stop your loop gracefully.
4. I would do something like this. The idea is to store you temperatures in an array and you just update the value you just received. Notice I reduced the read size to only cover one temperature at a time. But the powerful part is the Unflatten From String to parse the message for me. The cluster contains an U8 for the Start Byte, U8 for the Channel, a U16 for I don't know what they are for, and finally a U16 for the data. After that, it is just doing the math you already defined for the data and using the case structure to decide which element in the array I am replacing.
12-12-2019 09:56 AM
Hi again,
Yes, the manual seems to be wrong. The instrument is the RS PRO 1384 Temperature Data Logger:
https://uk.rs-online.com/web/p/data-loggers/1232235/
You can click on the user guide of its website and you will get the manual.
I will probably change the local variables to wires and insert the Stop button at a later stage, thanks for the advice.
Your point 4 looks nice, but since I am a beginner user of Labview, it is somewhat far from my current knowledge. Instead of that I found an alternative as shown in the attachment which now works.
However, I frequently find this error:
I think it might be related with the COM port getting blocked, maybe closing/opening issue. I have now put the open and close out of the loop but this error occurs again. Any idea about the reason?
12-12-2019 10:14 AM
@garciaj wrote:
Your point 4 looks nice, but since I am a beginner user of Labview, it is somewhat far from my current knowledge. Instead of that I found an alternative as shown in the attachment which now works.
That is why I gave you code so you could study it. That is how you expand your knowledge.
As far as your writing to the file, do not use the Write Delimited Spreadsheet function here. It opens and closes your file with each iteration. This will kill any performance you might have. Use the Open/Create/Replace File function before you loop to create the log file. Inside the loop, use Array To Spreadsheet String to format your data and then Write Text File to save the data to your file. Then use Close File after the loop. For logging inside of the same loop, this will give you the best performance. If you need more performance, then you will need to use a Producer/Consumer setup to move your logging to another loop.
12-12-2019 12:23 PM - edited 12-12-2019 12:24 PM
Get rid of the local variables. There is no reason to write a value to a terminal and the local variable of the same terminal at the same time!
If you do occasionally get the timeout error, then put some other indicators on there to help debug it. For instance, you ask for 48 bytes, but if you get less than that, you'll get a timeout error. When you get a timeout error, how many bytes did you actually receive? Put an indicator on that string to look at the message.
And definitely get rid of those other local variables and replace with wires. Be sure to get that done right away and before you post any updated version of your code to this thread.
11-09-2021 03:13 AM
Did you manage to write your VI successfully?
11-09-2021 03:20 AM
I think we stopped working with this apparatus since we bought another model. So we did not advance the code.
03-24-2023 11:18 AM - edited 03-24-2023 11:33 AM
@crossrulz wrote:
1. Again, what you are showing does not reflect the manual you gave us. Are you sure you have the right manual?
2. Do NOT use Local Variables here. They do nothing but add confusion and race conditions. Use wires!
3. You have an infinite loop. Stop using the Abort button in the toolbar to stop your VIs. Initialize you port before the loop, close it after the loop, and use a stop control to stop your loop gracefully.
4. I would do something like this. The idea is to store you temperatures in an array and you just update the value you just received. Notice I reduced the read size to only cover one temperature at a time. But the powerful part is the Unflatten From String to parse the message for me. The cluster contains an U8 for the Start Byte, U8 for the Channel, a U16 for I don't know what they are for, and finally a U16 for the data. After that, it is just doing the math you already defined for the data and using the case structure to decide which element in the array I am replacing.
Hi, I am a very new user to LabVIEW and would like to ask about this VI. It seems like you intended to convert from the Fahrenheit output to Celsius, but when I run the VI the front panel temp shows a value in the thousands. Adding a probe to the data wire shows the correct Deg F temperature. But there is some error happening when converting. Even removing the conversion operation results in an incorrect reading on the front panel.
Would you have a solution for this?
03-24-2023 12:17 PM
Hi JD,
@JDSuper wrote:
Hi, I am a very new user to LabVIEW and would like to ask about this VI. It seems like you intended to convert from the Fahrenheit output to Celsius, but when I run the VI the front panel temp shows a value in the thousands. Adding a probe to the data wire shows the correct Deg F temperature. But there is some error happening when converting. Even removing the conversion operation results in an incorrect reading on the front panel.
Would you have a solution for this?
We probably would come with a solution rather quickly - as soon as you attach your VI!
(When you are using one of the latest LabVIEW versions, like LV2022 or above, then I would recommend to downconvert to LV2021 or LV2019 to get a broader audience…)
03-24-2023 02:35 PM
@JDSuper wrote:
Hi, I am a very new user to LabVIEW and would like to ask about this VI. It seems like you intended to convert from the Fahrenheit output to Celsius, but when I run the VI the front panel temp shows a value in the thousands. Adding a probe to the data wire shows the correct Deg F temperature.
Are you talking about the blue wire coming out of the "data" unbundle node or the raw string received from the instrument?
How does the raw string look like? Do you have documentation? Are you sure the unflatten operation uses the correct datatypes?
Please attach a simple VI containing a typical sample of the received string verbatim as diagram constant (*see below) and tell us what temperature you are expecting to see.
*(i.e. create an indicator on the pink wire, run the VI, stop the VI, right-click the new indicator and "change to constant", save the VI under a new name and attach it here)
03-24-2023 08:09 PM
Hi Crossrulz, Mr.Altenbach, Gerdw
Can one of you please explain to me the 1,11 / 2,12/ etc... part of the case structure? I just want to expand my knowledge.
2nd question) Does the case structure's radix should always be changed based on the type of data being read?
I look forward to hearing from anyone who understands this.