private void frmSetBitOut_Load(object sender, EventArgs e) { string PortName; MccDaq.ErrorInfo ULStat; InitUL(); //determine if digital port exists, its capabilities, etc PortType = clsDigitalIO.PORTOUT; NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); if (NumBits > 8) { NumBits = 8; } for (int I = NumBits; I < 8; ++I) { chkSetBit[I].Visible = false; } if (NumPorts == 0) { lblInstruct.Text = "Board " + DaqBoard.BoardNum.ToString() + " has no compatible digital ports."; for (int I = 0; I < 8; ++I) { chkSetBit[I].Enabled = false; } } else { // if programmable, set direction of port to output // configure the first port for digital output // Parameters: // PortNum :the output port // Direction :sets the port for input or output if (ProgAbility == clsDigitalIO.PROGPORT) { Direction = MccDaq.DigitalPortDirection.DigitalOut; ULStat = DaqBoard.DConfigPort(PortNum, Direction); } PortName = PortNum.ToString(); lblInstruct.Text = "Set the output value of " + PortName + " on board " + DaqBoard.BoardNum.ToString() + " bits using the check boxes."; } }
private void frmDigIn_Load(object sender, EventArgs e) { MccDaq.ErrorInfo ULStat; InitUL(); //determine if digital port exists, its capabilities, etc PortType = clsDigitalIO.PORTIN; NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); if (NumBits > 8) { NumBits = 8; } for (int i = NumBits; i < 8; ++i) { lblShowBitVal[i].Visible = false; lblShowBitNum[i].Visible = false; } if (NumPorts == 0) { lblInstruct.Text = "Board " + DaqBoard.BoardNum.ToString() + " has no compatible digital ports."; } else { // if programmable, set direction of port to input // configure the first port for digital input // Parameters: // PortNum :the input port // Direction :sets the port for input or output if (ProgAbility == clsDigitalIO.PROGPORT) { Direction = MccDaq.DigitalPortDirection.DigitalIn; ULStat = DaqBoard.DConfigPort(PortNum, Direction); } PortName = PortNum.ToString(); lblInstruct.Text = "You may change the value read by applying " + "a TTL high or TTL low to digital inputs on " + PortName + " on board " + DaqBoard.BoardNum.ToString() + "."; lblBitNum.Text = "The first " + NumBits.ToString() + " bits are:"; lblBitVal.Text = PortName + " value read:"; tmrReadInputs.Enabled = true; } }
private void frmDigIn_Load(object sender, EventArgs e) { string PortName, BitName; MccDaq.ErrorInfo ULStat; InitUL(); //determine if digital port exists, its capabilities, etc PortType = clsDigitalIO.BITIN; NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); if (!(ProgAbility == clsDigitalIO.PROGBIT)) { NumPorts = 0; } if (NumPorts == 0) { lblInstruct.Text = "Board " + DaqBoard.BoardNum.ToString() + " has no compatible digital ports."; } else { // if programmable, set direction of bit to input // configure the first bit for digital input // Parameters: // PortNum :the input port // Direction :sets the port for input or output Direction = MccDaq.DigitalPortDirection.DigitalIn; ULStat = DaqBoard.DConfigBit(PortNum, FirstBit, Direction); PortName = PortNum.ToString(); BitName = FirstBit.ToString(); lblInstruct.Text = "You may change the bit state by applying a TTL high " + "or a TTL low to the corresponding pin on " + PortName + ", bit " + BitName + " on board " + DaqBoard.BoardNum.ToString() + "."; tmrReadInputs.Enabled = true; } }
private void frmSetDigOut_Load(object sender, EventArgs e) { MccDaq.ErrorInfo ULStat; InitUL(); //determine if digital port exists, its capabilities, etc PortType = clsDigitalIO.PORTOUT; NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); if (NumPorts == 0) { lblInstruct.Text = "Board " + DaqBoard.BoardNum.ToString() + " has no compatible digital ports."; hsbSetDOutVal.Enabled = false; txtValSet.Enabled = false; } else { // if programmable, set direction of port to output // configure the first port for digital output // Parameters: // PortNum :the output port // Direction :sets the port for input or output if (ProgAbility == clsDigitalIO.PROGPORT) { Direction = MccDaq.DigitalPortDirection.DigitalOut; ULStat = DaqBoard.DConfigPort(PortNum, Direction); } PortName = PortNum.ToString(); lblInstruct.Text = "Set the output value of " + PortName + " on board " + DaqBoard.BoardNum.ToString() + " using the scroll bar or enter a value in the 'Value set' box."; lblValSet.Text = "Value set at " + PortName + ":"; lblDataValOut.Text = "Value written to " + PortName + ":"; } }