I am using posiflex customer display, and I am trying to clear the display. I have gone through the user's manual, and I found PST command mode, which uses hex codes. I don't know how to pass these hex codes to serial port to clear my display. From the manual, I need to send the following hex numbers:
14 0E
I tried the following code to send these bytes, but I don't know how to pass two bytes at the same time.
SerialPort sp = new SerialPort();
sp.PortName = "COM6";
sp.BaudRate = 9600;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.Open();
byte[] bytestosend = new byte[1] { 0x0E };
sp.Write(bytestosend, 0, 1);
sp.Close();
sp.Dispose();
sp = null;
When i use this code, no operation is performed (display is not cleared).
To send multiple bytes just use comma to separate the bytes. You should have something like this:
sp.PortName = "COM6";
sp.BaudRate = 9600;
sp.Parity = Parity.None;
sp.DataBits = 8;
sp.StopBits = StopBits.One;
sp.Open();
byte[] bytestosend = { 0x14, 0x0E };
sp.Write(bytestosend, 0, bytestosend.Length);
sp.Close();
sp.Dispose();
sp = null;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With