Пример #1
0
        public byte readByte()
        {
            byte input = 0;

            switch (mode)
            {
            case "COM":
                if (lambdaRS232.IsOpen && lambdaRS232.BytesToRead > 0)
                {
                    input = (byte)lambdaRS232.ReadByte();
                }
                break;

            case "LPT":
                input = 13;
                break;

            case "USB":
                input = lambdaUSB.ReadByte();
                break;

            default:
                input = (byte)123;
                break;
            }
            return(input);
        }
Пример #2
0
        public byte readByte()
        {
            byte input = 0;

            switch (mode)
            {
            case "COM":
                if (lambdaRS232.IsOpen && lambdaRS232.BytesToRead > 0)
                {
                    input = (byte)lambdaRS232.ReadByte();
                }
                break;

            case "LPT":
                input = 13;
                break;

            case "USB":
                input = lambdaUSB.ReadByte();
                break;

            default:
                input = (byte)123;
                break;
            }
            ;
            txtComOutput.AppendText("Write:" + Environment.NewLine + "Sts.| Dec. | Hex. " + Environment.NewLine);
            string hexOutput = String.Format("{0:X}", input);
            string decOutput = String.Format("{0:g}", input);

            txtComOutput.AppendText(input.ToString() + "  " + decOutput + "    " + hexOutput + Environment.NewLine);
            return(input);
        }