Files

37 lines
728 B
VB.net
Raw Permalink Normal View History

2025-12-11 10:06:44 +08:00
Imports System.IO.Ports
Public Class UartServer
''' <summary>
''' 串口句柄
''' </summary>
Public Uart As SerialPort
Sub New(UartPort As String, UartBaud As Long, Uartdata As Long, UartParity As Parity, dataBits As Integer, UartStop As Integer)
Uart = New SerialPort(UartPort, UartBaud, UartParity, dataBits, UartStop)
End Sub
''' <summary>
''' 打开串口
''' </summary>
''' <returns></returns>
Public Function UartOPen() As Boolean
Try
Uart.Open()
Catch ex As Exception
End Try
Return Uart.IsOpen
End Function
Public Function UartSenddata(sendbuff() As Byte)
' Uart.s
End Function
End Class