private void Read_Port_Click(object sender, System.EventArgs e)
        {
            ushort PortAddr;

            PortAddr    = ushort.Parse(PortR1.Text, NumberStyles.HexNumber);
            PortR1.Text = PortAddr.ToString("X4");
            switch (C_ReadSize.SelectedIndex)
            {
            case 0: ValR1.Text = (TVicPort.ReadPort(PortAddr)).ToString("X2"); break;

            case 1: ValR1.Text = (TVicPort.ReadPortW(PortAddr)).ToString("X4"); break;

            case 2: ValR1.Text = (TVicPort.ReadPortL(PortAddr)).ToString("X8"); break;
            }
        }
        private void B_Test_Click(object sender, System.EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            ushort Cycle, NumPortCycles;
            ushort PortAddr;

            byte   DataByte;
            double a, b, r;

            PortAddr      = ushort.Parse(EPortAddr.Text, NumberStyles.HexNumber);
            NumPortCycles = ushort.Parse(E_Cycles.Text, NumberStyles.Integer);
            byte[] buffer = new byte[NumPortCycles];

            // Separate I/O operations

            a = DateTime.Now.Ticks;
            for (Cycle = 1; Cycle <= NumPortCycles; Cycle++)
            {
                DataByte = TVicPort.ReadPort(PortAddr);
            }
            b = DateTime.Now.Ticks;

            r            = System.Math.Abs(b - a) / (10 * NumPortCycles);
            L_Test1.Text = String.Concat(r.ToString("F4"), " microsec");

            // with ReadPortBuffer()

            a = DateTime.Now.Ticks;

            // Declare an unsafe block
            unsafe
            {
                // Fix the byte array.
                fixed(byte *array = buffer)
                {
                    // Make the call here, passing in the array.
                    TVicPort.ReadPortFIFO(PortAddr, NumPortCycles, array);
                }
            }
            b            = DateTime.Now.Ticks;
            r            = System.Math.Abs(b - a) / (10 * NumPortCycles);
            L_Test4.Text = String.Concat(r.ToString("F4"), " microsec");

            Cursor = Cursors.Default;
        }