/// <summary> /// Config the port to the Output /// </summary> public void DigitalConfigurationOut() { DigitalIO.clsDigitalIO DioProps = new DigitalIO.clsDigitalIO(); PortType = clsDigitalIO.PORTOUT; NumPort = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); MccDaq.DigitalPortDirection Direction = MccDaq.DigitalPortDirection.DigitalOut; ULStat = DaqBoard.DConfigPort(PortNum, Direction); }
private void frmDScan_Load(object sender, EventArgs e) { string AndString = string.Empty; string PortName = string.Empty; MccDaq.ErrorInfo ULStat; InitUL(); //determine if digital port exists, its capabilities, etc PortType = clsDigitalIO.PORTINSCAN; NumPorts = DioProps.FindPortsOfType(DaqBoard, PortType, out ProgAbility, out PortNum, out NumBits, out FirstBit); if (NumPorts > 2) { NumPorts = 2; } if (NumPorts == 0) { lblInstruct.Text = "Board " + DaqBoard.BoardNum.ToString() + " has no digital scan ports."; cmdReadDIn.Enabled = false; cmdTemp.Enabled = false; } else { DataBuffer = new ushort[NumPoints]; // set aside memory to hold data MemHandle = MccDaq.MccService.WinBufAllocEx(NumPoints); MccDaq.DigitalPortType DigPort; // configure first one or two scan ports // for digital input (if programmable) // Parameters: // PortNum :the input port // Direction :sets the port for input or output for (int NumberOfPort = 0; NumberOfPort < NumPorts; ++NumberOfPort) { DigPort = PortNum + NumberOfPort; PortName = PortName + AndString + DigPort.ToString(); if (ProgAbility == clsDigitalIO.PROGPORT) { Direction = DigitalPortDirection.DigitalIn; ULStat = DaqBoard.DConfigPort(PortNum, Direction); } AndString = " and "; } lblInstruct.Text = "Scanning digital input port at " + PortName + " on board " + DaqBoard.BoardNum.ToString() + "."; } Force = 0; }
private void cmdEndProgram_Click(object eventSender, System.EventArgs eventArgs) { if (ProgAbility == clsDigitalIO.PROGPORT) { ushort DataValue = 0; MccDaq.ErrorInfo ULStat = DaqBoard.DOut(PortNum, DataValue); Direction = MccDaq.DigitalPortDirection.DigitalIn; ULStat = DaqBoard.DConfigPort(PortNum, Direction); } Application.Exit(); }
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 + ":"; } }