Translation: Good morning, I would like to know if you can help me with the connection of a digital scale brand digitalpos model DIG-B01 I have the connection already ready but I cannot capture the value of the weight since the scale is of continuous response and returns a data frame the code is the following
private void BtnProbar_Click(object sender, EventArgs e) { try { Puertos = new SerialPort(CbxPuertos.Text, 9600, Parity.None, 8, StopBits.One); Puertos.Handshake = Handshake.None; Puertos.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived); Puertos.ReadTimeout = 500; Puertos.WriteTimeout = 500; Puertos.Handshake = Handshake.None; Puertos.Open(); Puertos.WriteLine("0P"); if (Puertos.IsOpen) lEstado.Text = "Conectado"; else MessageBox.Show("Fallo la conexion"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } void sp_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { if (this.Enabled == true) { Thread.Sleep(500); string data = Puertos.ReadExisting(); this.BeginInvoke(new DelegadoAcceso(si_DataReceived), new object[] { data }); } } catch (Exception ex) { } } private void si_DataReceived(string accion) { this.TxValue.Text = accion; Puertos.Close(); }
Translation: this is the code I have so far and it captures the following data frame
\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002S 00.225kgd\u0003\u0004\0\u0001\u0002"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)