03-04-2025 05:08 AM
Hello, I have an electronic scale with an RS-232 output, and I would like to print the data on my screen using the LabVIEW program. The device's manual is in Chinese, so all the information I have is in Chinese.
I translated the manual into English using Google Lens.
Can you help me create a simple design to display the scale's measurements on the screen?
Thanks!
03-04-2025 09:21 AM
Start with watching this video VIWeek 2020/Proper way to communicate over serial
Try a few things out, then if you need more help come back and show us what you tried and the issues you are having.
03-05-2025 05:18 AM
03-05-2025 05:54 AM
Hi Thanos,
@Thanos_9456 wrote:
I followed some tutorials and made an example of how to communicate using the serial port.
But you didn't follow the suggestions/recommendations given in the video, linked to in the message before…
(This REALLY is a great tutorial video!)
03-05-2025 06:22 AM - edited 03-05-2025 06:32 AM
Several additional points to what Gerd said:
- How did you decide that 7 data bits, 1 stop bit, and even parity matches with the explanation in your data sheet about 10 bits (one start bit, 8 data bits and one stop bit) and no parity?
- The datasheet specifies continous output, this usually means there is no command to request anything from the device, it simply keeps spewing data at an unknown rate until you switch it off.
That means that there is nothing you should write to the device and simply wait for a response and then go back to wait for the next response.
- The data format is terminated with two 0xD characters. So you should configure the port to use this character as termination character. But since they decided to use two termination characters you will have to read first the data frame and then again to read the second termination character before relooping. You should basically NEVER use the Bytes at Serial Port. Another approach is to always try to read 19 characters but that is less reliable.
03-05-2025 08:05 AM
Thank you all very much for the immediate help.
Sorry for asking so many things, I'm just using labview for the first time!
Is it better now?
I have set the termination character to the number 13 which corresponds to 0x0d
03-05-2025 08:43 AM - edited 03-05-2025 08:47 AM
Still many things not quite right.
1) Just setting the Term Char alone is not enough. The Serial Port Init function from before was not wrong, you just had wired several of the values wrong. And it should be before the loop as before, not inside the loop as you did now with the Open function.
2) The VISA Write is almost certainly superfluous, and potentially problematic. Continuous output mode means that the device simply talks and talks and talks and talks, without having to be prompted to do so with any command. Even if it would need a command, chances that that would be *IDN? are abut -100%.
3) Make the number to read at least 19, rather than 10. Each message contains 19 characters. And add a second Read after that to read the second 0x0D character. VISA Read if set to terminate on termination character will terminate on the first occurence of that character. But your message contains two of them, so you need to do another read to get that from the input buffer.
4) Also put the Close function outside the loop after your loop stops.
5) That Delay of 1000 ms is going to be possibly problematic. If the device produces more than one measurement per second, your loop will lag more and more behind the data send by the device. You can leave that out, since the VISA Read will simply wait until a message frame has arrived and that will synchronize your loop with the speed of the device.
04-14-2025 07:45 AM
I finally managed to read the output from the scale, but I didn’t want to do just that.
I also want to read the temperature from a thermocouple, which I’ve connected to an Arduino.
In the image below,
you can see that I have a while loop for each serial connection, and it works without any problems. However, I can’t display the data on an XY plot.
But when I remove the two inner while loops and use just one common while loop, then I can’t get data from the scale. It shows data infrequently, as if it’s getting stuck somewhere.
How can this be solved?
04-16-2025 06:44 AM
Any suggestion?
Thanks!