DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
Hao0420

I'm right now trying to read sensor data through USB-RS485 converter and utilizing the EasyModbus.dll in C#.

However, I've kept receiving CRC checked failed at the ReadHoldingRegister part. The connection and reading part is shown below.

I've already done lots of research but still can't solve the issue. Can anyone help me with this?

The CRC checked failed will occur at

int[] Read = modbusClient.ReadHoldingRegisters(179, 6);

The FT300 Modbus Setting is also shown below:

enter image description here

Image is stolen from this manual, page 34

   void getavailableports() // get available COM
   {
        comboBox1.Items.Clear();
        string[] ports = SerialPort.GetPortNames();
        comboBox1.Items.AddRange(ports);
   }
   private void comboBox1_MouseClick(object sender, MouseEventArgs e) //let user choose COM
   {
        getavailableports();
   }
   private void Start_Click(object sender, EventArgs e) // Start button being pressed
   {
        try
        {
            Invoke(new EventHandler(ChangeColor));
            //FT300Port.PortName = comboBox1.Text;
            //.BaudRate = Convert.ToInt32(BaudRate.Text);
            //FT300Port.Open();
            modbusClient.UnitIdentifier = 9; // default slaveID = 1
            modbusClient.Baudrate = Convert.ToInt32(BaudRate.Text); // default baudrate = 9600
            modbusClient.Parity = System.IO.Ports.Parity.None;
            modbusClient.StopBits = System.IO.Ports.StopBits.One;
            modbusClient.ConnectionTimeout = 500;
            modbusClient.Connect();
            lb_status.Text = "Connected";
            timer_Modbus.Enabled = true;
        }
        catch(Exception ex)
        {
            lb_status.Text = ex.ToString();
            throw;
        }
    }
    private void ChangeColor(object sender, EventArgs e)
    {
        Start.Text = "Streaming";
        Start.BackColor = Color.Red;
    }
    private void Disconnect_Click(object sender, EventArgs e)
    {
        modbusClient.Disconnect();
        Start.Text = "Start";
        Start.BackColor = Color.DarkGray;
        lb_status.Text = "Disconnected";
        timer_Modbus.Enabled = false;
    }
    private void timer_Modbus_Tick(object sender, EventArgs e)
    {
        timer_Modbus.Enabled = false;

        //modbusClient.WriteMultipleCoils(179, new bool[] { true, true, true, true, true, true});    
        //Write Coils starting with Address 180
        //bool[] readCoils = modbusClient.ReadCoils(179, 6);
        **int[] Read = modbusClient.ReadHoldingRegisters(179, 6);**

      /*textBox1.Text = Convert.ToString(Read[0]);
        textBox2.Text = Convert.ToString(Read[1]);
        textBox3.Text = Convert.ToString(Read[2]);
        textBox4.Text = Convert.ToString(Read[3]);
        textBox5.Text = Convert.ToString(Read[4]);
        textBox6.Text = Convert.ToString(Read[5]);*/

        timer_Modbus.Enabled = true;
    }

syed

Hao0420 said:

I'm right now trying to read sensor data through USB-RS485 converter and utilizing the EasyModbus.dll in C#.

However, I've kept receiving CRC checked failed at the ReadHoldingRegister part. The connection and reading part is shown below.

I've already done lots of research but still can't solve the issue. Can anyone help me with this?

The CRC checked failed will occur at

int[] Read = modbusClient.ReadHoldingRegisters(179, 6);

The FT300 Modbus Setting is also shown below:

enter image description here

Image is stolen from this manual, page 34

   void getavailableports() // get available COM
   {
        comboBox1.Items.Clear();
        string[] ports = SerialPort.GetPortNames();
        comboBox1.Items.AddRange(ports);
   }
   private void comboBox1_MouseClick(object sender, MouseEventArgs e) //let user choose COM
   {
        getavailableports();
   }
   private void Start_Click(object sender, EventArgs e) // Start button being pressed
   {
        try
        {
            Invoke(new EventHandler(ChangeColor));
            //FT300Port.PortName = comboBox1.Text;
            //.BaudRate = Convert.ToInt32(BaudRate.Text);
            //FT300Port.Open();
            modbusClient.UnitIdentifier = 9; // default slaveID = 1
            modbusClient.Baudrate = Convert.ToInt32(BaudRate.Text); // default baudrate = 9600
            modbusClient.Parity = System.IO.Ports.Parity.None;
            modbusClient.StopBits = System.IO.Ports.StopBits.One;
            modbusClient.ConnectionTimeout = 500;
            modbusClient.Connect();
            lb_status.Text = "Connected";
            timer_Modbus.Enabled = true;
        }
        catch(Exception ex)
        {
            lb_status.Text = ex.ToString();
            throw;
        }
    }
    private void ChangeColor(object sender, EventArgs e)
    {
        Start.Text = "Streaming";
        Start.BackColor = Color.Red;
    }
    private void Disconnect_Click(object sender, EventArgs e)
    {
        modbusClient.Disconnect();
        Start.Text = "Start";
        Start.BackColor = Color.DarkGray;
        lb_status.Text = "Disconnected";
        timer_Modbus.Enabled = false;
    }
    private void timer_Modbus_Tick(object sender, EventArgs e)
    {
        timer_Modbus.Enabled = false;

        //modbusClient.WriteMultipleCoils(179, new bool[] { true, true, true, true, true, true});    
        //Write Coils starting with Address 180
        //bool[] readCoils = modbusClient.ReadCoils(179, 6);
        **int[] Read = modbusClient.ReadHoldingRegisters(179, 6);**

      /*textBox1.Text = Convert.ToString(Read[0]);
        textBox2.Text = Convert.ToString(Read[1]);
        textBox3.Text = Convert.ToString(Read[2]);
        textBox4.Text = Convert.ToString(Read[3]);
        textBox5.Text = Convert.ToString(Read[4]);
        textBox6.Text = Convert.ToString(Read[5]);*/

        timer_Modbus.Enabled = true;
    }
Did you figure out the problem ?

Hao0420