Click here to Skip to main content
15,991,072 members

Comments by Bernardo Martinez (Top 2 by date)

Bernardo Martinez 17-Jan-24 9:25am View    
I tried the communication successfully, however when I made the request by command I did not get a response
Bernardo Martinez 17-Jan-24 8:42am View    
I downloaded the manual, reviewed the codes, however I have not achieved communication https://cdn.shopify.com/s/files/1/2482/2334/files/Manual_de_usuario_YP200.pdf?4035985435804019145
anexo codigo

private void Form1_Load(object sender, EventArgs e)
{
string data = "02(hex)B03(hex)";

try
{
serialPort1 = new SerialPort("COM8", 9600, Parity.None, 8, StopBits.One);
serialPort1.Handshake = Handshake.None;
serialPort1.DataReceived += new SerialDataReceivedEventHandler(sp_DataReceived);
serialPort1.ReadTimeout = 500;
serialPort1.WriteTimeout = 500;
serialPort1.Open();
serialPort1.Write("02(hex)B03(hex)");
}
catch (Exception ex)
{
MessageBox.Show("MENSAGE:",ex.Message);
}

}
void sp_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
MessageBox.Show("sp_DataReceived");
if (this.Enabled == true)
{
MessageBox.Show("Enabled");
Thread.Sleep(500);
string data = serialPort1.ReadExisting();
this.BeginInvoke(new DelegadoAcceso(si_DataReceived), new object[] { data });
}
}