初始化项目
This commit is contained in:
36
BLV_Studio/UART/UartServer.vb
Normal file
36
BLV_Studio/UART/UartServer.vb
Normal file
@@ -0,0 +1,36 @@
|
||||
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
|
||||
Reference in New Issue
Block a user