Ejemplo n.º 1
0
        private void Write_Port_Click(object sender, System.EventArgs e)
        {
            ushort PortAddr;
            uint   lVal;
            byte   bVal;
            ushort wVal;

            PortAddr    = ushort.Parse(PortW1.Text, NumberStyles.HexNumber);
            PortW1.Text = PortAddr.ToString("X4");
            switch (C_WriteSize.SelectedIndex)
            {
            case 0:
                bVal = byte.Parse(ValW1.Text, NumberStyles.HexNumber);
                TVicPort.WritePort(PortAddr, bVal);
                break;

            case 1:
                wVal = ushort.Parse(ValW1.Text, NumberStyles.HexNumber);
                TVicPort.WritePortW(PortAddr, wVal);
                break;

            case 2:
                lVal = uint.Parse(ValW1.Text, NumberStyles.HexNumber);
                TVicPort.WritePortL(PortAddr, lVal); break;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }