STM32
的串口下载程序Flash
Loader
Demonstrator,在其安装目录下有个Src目录,里面就有这个Flash
Loader
Demonstrator的源代码,VC++6的,如何通过USB
的虚拟串口类实现IAP通讯的,你可以那它来参考。
查看更多答案>>
1.选择STM32和上位机通信,串口,USB,网口等
2.
编写AD7606驱动和通信驱动
3.
编写上位机程序用于接收采集到的数据
4.
创建STM32工程,循环采集数据并通过通信口上传到上位机
5.
上位机显示采集数据
用 socket 类 udp tcp 我这 给你个 最简单的 例子 udp
服务器端
Imports System.Net.Sockets
Imports System.Net
Module socketsever
Sub main()
startserver()
End Sub
Private Sub startserver()
'创建服务器端的socket
Dim sServer As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
Dim myip As IPAddress
'制订本地回路的ip地址
myip = IPAddress.Parse("10.13.115.105")
'设置服务器端口号
Dim sServerep As New IPEndPoint(myip, 2001)
'设置客户端的端口号
Dim clientep As New IPEndPoint(myip, 2002)
'将端口与socket绑定
sServer.Bind(sServerep)
While True
Try
Dim bytes(100) As Byte
'等待客户端的请求
sServer.ReceiveFrom(bytes, clientep)
Dim str As String = System.Text.Encoding.ASCII.GetString(bytes)
'将字符转化成大写
str = str.ToUpper
bytes = System.Text.Encoding.ASCII.GetBytes(str)
'返回结果
sServer.SendTo(bytes, clientep)
Catch e As SocketException
End Try
End While
End Sub
End Module
客户端
界面 和程序
Imports System.Net.Sockets
Imports System.Net
Public Class Form1
Inherits System.Windows.Forms.Form
Private Sub bsend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bsend.Click
'创建客户端的socket
Dim cClient As New Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)
'指定本地回路的ip地址
Dim myip, myip1 As IPAddress
myip = IPAddress.Parse("10.13.115.105")
myip1 = IPAddress.Parse("10.13.115.136")
'设置服务器端口号
Dim Serverep As New IPEndPoint(myip1, 2001)
'设置客户端的端口号
Dim clientep As New IPEndPoint(myip, 2002)
'将端口与socket绑定
cClient.Bind(clientep)
Try
Dim str As String = Textinput.Text
Dim bytes() As Byte = System.Text.Encoding.ASCII.GetBytes(str)
'向服务器发出请求
cClient.SendTo(bytes, Serverep)
Dim bytes2(100) As Byte
'接受服务器的响应结果
cClient.ReceiveFrom(bytes2, Serverep)
str = System.Text.Encoding.ASCII.GetString(bytes2)
'将结果显示在文本框中
Textdisplay.Text = Textdisplay.Text & vbNewLine & str
Catch er As SocketException
MsgBox(er.ToString)
End Try
cClient.Close()
End Sub
End Class
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)