public struct VCI_INIT_CONFIG
{
public UInt32 AccCode;
public UInt32 AccMask;
public UInt32 Reserved;
public byte Filter; //0或1接收所有帧。2标准帧滤波,3是扩展帧滤波。
public byte Timing0; //波特率参数,具体配置,请查看二次开发库函数说明书。
public byte Timing1;
public byte Mode; //模式,0表示正常模式,1表示只听模式,2自测模式
}
VCI_CAN_OBJ sendobj = new VCI_CAN_OBJ();
//sendobj.Init();
sendobj.SendType = (byte)comboBox_devtype.SelectedIndex;
sendobj.RemoteFlag = (byte)comboBox_FrameFormat.SelectedIndex;
sendobj.ExternFlag = (byte)comboBox_FrameType.SelectedIndex;
sendobj.ID = System.Convert.ToUInt32("0x" + textBox_ID.Text, 16);//1、转换后发过去的消息是什么?
int len = (textBox1.Text.Length + 1) / 3; //textBox1.Text = "00 00 00 00 00 08 00 00 ";
sendobj.DataLen = System.Convert.ToByte(len);
String strdata = textBox1.Text;
int i = -1;
if (i++ < len - 1)//这段代码什么意思?
sendobj.Data[0] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);//这个发过去的具体是什么?
if (i++ < len - 1)
sendobj.Data[1] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[2] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[3] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[4] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[5] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[6] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);
if (i++ < len - 1)
sendobj.Data[7] = System.Convert.ToByte("0x" + strdata.Substring(i * 3, 2), 16);