public class Com_Class
{
//声明串口 //属性
public SerialPort m_SerialPort;
public string m_CommPort;//串口名
public int m_BaudRate; //波特率
public int m_DataBit;//数据位
public StopBits m_StopBit;//停止位
public Parity m_Parity;//奇偶校
/// <summary>串口初始化</summary>
/// <param name="CommPort">串口名称"COM1"</param>
/// <param name="BaudRate">波特率</param>
/// <param name="Party">奇偶校验</param>
/// <param name="dataBit">数据位</param>
/// <param name="StopBit">停止位</param>
public int InitCom(string CommPort, int BaudRate,Parity Party, int dataBit, StopBits StopBit)
{
int err = -1;
try
{
//传入参数
m_CommPort = CommPort;
m_BaudRate = BaudRate;
m_Parity = Party;
m_DataBit = dataBit;
m_StopBit = StopBit;
if (m_SerialPort == null)
{
m_SerialPort = new SerialPort(m_CommPort, m_BaudRate, m_Parity, m_Dat