串口给单片机发送数据格式问题!

AA 55 00 01 01 00 00这个指令目前是字符串,我应该怎样处理这个字符串之后发给单片机呢,求大神指点一下!

应该转换为byte[] ,
C#中这样写 byte[] bt=new byte[]{0xAA,0x55,0x00,0x01,0x01,0x00,0x00};
随后将这个数据写入串口

static byte[] ToBytes(string hexStr)
{
    string[] hexSplits = hexStr.Split('-');
    byte[] a = new byte[hexSplits.Count()];
    for (int i = 0; i < a.Count() - 1; i++)
    {
        a[i] = Convert.ToByte(hexSplits[i], 16);
    }
    return a;
}

// 调用方式
string strData = "AA 55 00 01 01 00 00";
byte[] a = ToBytes(strData.Replace(" ", "-"));

因为 BitConverter.ToString(a) 结果是用 - 作为分隔符的,所以统一替换了一下。
如果你无所谓,也可以直接用空格作为分隔符。