需要发送数字 151510
大端序发送就是 :00 02 4F D6
string smallData = textBox1.Text;//小端数据
if (smallData == "")
{
MessageBox.Show("请输入初始里程", "错误",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox1.Text = "";
return;
}
if (!IsNumeric(smallData))
{
MessageBox.Show("初始里程必须是数字", "错误",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
textBox1.Text = "";
return;
}
double doubleSmallData = Convert.ToDouble(smallData) * 10;
int intSmallData = Convert.ToInt32(doubleSmallData);
//int x = 439041118; // 十六进制为 1A2B3C5E intSmallData
string s = null;
byte[] b = BitConverter.GetBytes(intSmallData);
s = BitConverter.ToString(b);
textData = "01 0" + comboBox2.SelectedIndex + " 00 00 " + s + " ";
retryCounts = 0;
sendCounts = 0;
bool result = sendMsg(textBox2.Text, textData);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)