比例指示器编程代码 [英] Scale indicator programming code

查看:86
本文介绍了比例指示器编程代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我希望我的信息很好找

我对visual basic 2005编程代码有问题,让程序读取来自刻度指示器的串行端口的数据如下所示,您将在运行程序后找到程序代码和数据的图片。

我想阅读并且只显示一个来自瞬时数据的文本框。图片显示了我想要阅读和出现的数据,但我不知道如何得到这个结果。指标的代码和协议你也会发现它。

please如果可以,请帮助我。



scale2 - imgbb.com [ ^ ]

scale1 - imgbb.com [ ^ ]



我的尝试:



hello
I hope my message find you well
I have problem with programming code by visual basic 2005 to make a program to read the data that come from the serial port of the scale indicator bellow you will find a picture for the code of the program and the data after running the program.
I want to read and appear only one in a textbox from the Instantaneous data. the picture show you the data that I wanted to read and appear but i don't know how can i get this result.the code and the protocol of the indicator you will find it bellow too.
please help me if you can.

scale2 — imgbb.com[^]
scale1 — imgbb.com[^]

What I have tried:

Private Sub SerialPort1_DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived

        receivedtext(SerialPort1.ReadExisting())

    End Sub

    Private Sub receivedtext(ByVal [text] As String)

        If Me.screen.InvokeRequired Then

            Dim x As New settextcallback(AddressOf receivedtext)

            Me.Invoke(x, New Object() {(text)})

        Else

            Me.screen.Text &= [text]

        End If

    End Sub

推荐答案

在以下代码段 Txt 是要分解的字符串
In the following snippet Txt is the string you want to break down
Dim parts = Txt.Split(New Char() {","}, StringSplitOptions.RemoveEmptyEntries)
If parts.Length > 3 Then
   TextBox1.Text = parts(3).Replace("kg", "")
End If





有关读取串口的示例,请参阅基本串口侦听应用程序 [ ^ ](C#我很害怕)或使用VB.NET简化COM端口 [ ^ ]



For an example of reading the Serial port see Basic serial port listening application[^] (C# I'm afraid) or COM port made simple with VB.NET[^]

这篇关于比例指示器编程代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆