using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using pac8014WNet; using System.Runtime.InteropServices; namespace pac_i8014W_BasicInfo { public partial class Form1 : Form { private static Int16 slotIndex = 0, jumper = 0, maxCh =8, gain = 0; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void cboSlot_SelectedIndexChanged(object sender, EventArgs e) { int ret = -1; Int16 firmware, isofirm, libVer; string[] SingleEndedStr= new string[2]; SingleEndedStr[0]="Differential"; SingleEndedStr[1]="Single Ended"; ret = pac8014W.Init((Int16)cboSlot.SelectedIndex); if (ret == 0) { slotIndex = (Int16)cboSlot.SelectedIndex; libVer = pac8014W.LibVersion(); lbVer.Text = libVer.ToString("X"); firmware = pac8014W.FirmwareVer_L1(slotIndex);// pac8014W.FirmwareVer_L1(slotIndex); lbFirm1.Text = firmware.ToString(); isofirm = pac8014W.FirmwareVer_L2(slotIndex); lbFirm2.Text = isofirm.ToString(); jumper = pac8014W.SingleEndJumper(slotIndex); lbJumper.Text = SingleEndedStr[jumper]; } else { MessageBox.Show("I-8014W is not at slot " + cboSlot.SelectedIndex.ToString()); } } private void btnExit_Click(object sender, EventArgs e) { Application.Exit(); } private void btnAIHex_Click(object sender, EventArgs e) { TextBox[] txtAI = { txtAI0, txtAI1, txtAI2, txtAI3, txtAI4, txtAI5, txtAI6, txtAI7, txtAI8, txtAI9, txtAI10, txtAI11, txtAI12, txtAI13, txtAI14, txtAI15 }; Int16 ch; Int16 ret; float fVal = 0; if (jumper == 1) //Single Ended Mode { maxCh = 16; } else { maxCh = 8; } for (ch = 0; ch < maxCh; ch++) { ret = pac8014W.ReadAI(slotIndex, ch, gain, ref fVal); if (ret == 0) { txtAI[ch].Text = fVal.ToString("F03"); // txtAI[ch].Text = "Gain[" + gain.ToString() + "] " + String.Format("{0:X4}",fVal); } else { txtAI[ch].Text = "ReadAI Error = " + ret.ToString(); } } } private void cboType0_SelectedIndexChanged(object sender, EventArgs e) { UInt16 gainValue = 0; Int16 offsetValue = 0; gain = (Int16)cboType0.SelectedIndex; pac8014W.ReadGainOffset(slotIndex, gain, ref gainValue, ref offsetValue); lbGain.Text = gainValue.ToString(); lbOffset.Text = offsetValue.ToString(); } } }