private void button1_Click(object sender, EventArgs e) { byte commandAddr = Convert.ToByte(comboBox1.Text); CmdInit ci = new CmdInit(); addrc = ci.GetInLevelUsefulCmd(commandAddr); richTextBox1.Text = DataChange.byteToHexStr(addrc); }
private void button1_Click(object sender, EventArgs e) { byte commandAddr = (byte)((comboBox1.Text == "X轴") ? 0x00 : 0x01); CmdInit ci = new CmdInit(); addrc = ci.GetAxisValueCmd(commandAddr); richTextBox1.Text = DataChange.byteToHexStr(addrc); }
private void button1_Click(object sender, EventArgs e) { //具体参数文档和串口助手不一致,?、 byte commandAddr = (byte)((comboBox1.Text == "0控制板") ? 0x00 : 0x01);; CmdInit ci = new CmdInit(); addrc = ci.GetMachineValueCmd(commandAddr); richTextBox1.Text = DataChange.byteToHexStr(addrc); }
public void GetOutLevelUsefulCmdTest() { //AA 05 01 A4 00 A0 CmdInit cf = new CmdInit(); byte[] ret = cf.GetOutLevelUsefulCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xA0); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA4); }
public void GetXAxisCmdTest() { //AA 05 01 A2 00 A6 CmdInit cf = new CmdInit(); byte[] ret = cf.GetAxisCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xA6); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA2); }
public void GetBaudRateCmdTest() { //AA 05 01 A1 00 A5 CmdInit cf = new CmdInit(); byte[] ret = cf.GetBaudRateCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xA5); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA1); }
public void GetSettedLimiteValueCmdTest() { //AA 05 01 A9 00 AD CmdInit cf = new CmdInit(); byte[] ret = cf.GetSettedLimiteValueCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xAD); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA9); }
public void GetMachineValueCmdTest() { //AA 05 01 A8 00 AC CmdInit cf = new CmdInit(); byte[] ret = cf.GetMachineValueCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xAC); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA8); }
public void GetAxisValueCmdTest() { //AA 05 01 A7 00 A3 CmdInit cf = new CmdInit(); byte[] ret = cf.GetAxisValueCmd(0x00); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xA3); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xA7); }
public void GetAddrCmdTest() { //AA 05 00 A0 01 A4 CmdInit cf = new CmdInit(); Global.gCommandAddr = 0x00; byte[] ret = cf.GetAddrCmd(0x01); Assert.AreEqual(ret.Count(), 6); Assert.AreEqual(ret[5], 0xA4); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x05); Assert.AreEqual(ret[2], 0x00); Assert.AreEqual(ret[3], 0xA0); Global.gCommandAddr = 0x01; }
private void button1_Click(object sender, EventArgs e) { int commandAddr = Convert.ToInt16(comboBox1.Text); CmdInit ci = new CmdInit(); switch (commandAddr) { case 2400: { Global.gBaudRate = 0x00; break; } case 4800: { Global.gBaudRate = 0x01; break; } case 9600: { Global.gBaudRate = 0x02; break; } case 19200: { Global.gBaudRate = 0x03; break; } case 38400: { Global.gBaudRate = 0x04; break; } default: { Global.gBaudRate = 0x05; break; } } addrc = ci.GetBaudRateCmd(Global.gBaudRate); richTextBox1.Text = DataChange.byteToHexStr(addrc); }