Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm Developing a POS systems in C#, and I have a Display Poll (serial port by USB), and i'm facing an issue when i send something to be displayed on the device.

i have the following code:
C#
private void button3_Click(object sender, EventArgs e)
    SerialPort sport = new SerialPort("COM3", 9600, Parity.None, 8, StopBits.One);
        sport.Open();

        //Clear the Display
        sport.Write(new byte[] {0x0C}, 0,1);
        sport.Write("My System");
        //Goto Bottem Line - Most Left
        sport.Write(new byte[] { 0x0A, 0x0D }, 0, 2);

        sport.Write(textBox2.Text);
       // MessageBox.Show("Hello");

        sport.Close();



    }


if i use the above code the display will be like the following (not constant)

my my s my sy

every time something missing.

but if i uncommet the messagebox command every thing works fine.

i don't need the messagebox or any other command, What it wrong and what should i do?

Please Help
Posted

1 solution

Maybe your program is too fast.
You could add a delay after each sport.Write()
something like Thread.Sleep(100).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900