Add Comments & Bug fixes
This commit is contained in:
@@ -11,8 +11,14 @@ using Testrong.User.Program;
|
||||
|
||||
namespace Testrong.User.Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Keysight53220A Related
|
||||
/// </summary>
|
||||
public class Keysight53220A
|
||||
{
|
||||
/// <summary>
|
||||
/// Global variables
|
||||
/// </summary>
|
||||
public class Globals
|
||||
{
|
||||
public static int videfaultRM;
|
||||
@@ -24,14 +30,22 @@ namespace Testrong.User.Program
|
||||
public static bool connected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// KeysightMeasMode
|
||||
/// </summary>
|
||||
public enum KeysightMeasMode
|
||||
{
|
||||
FREQ,
|
||||
INIT
|
||||
}
|
||||
|
||||
// KeysightMeasMode PresentMode;
|
||||
|
||||
/// <summary>
|
||||
/// Initial DMM
|
||||
/// </summary>
|
||||
/// <param name="address">DMM USB ADDR</param>
|
||||
/// <param name="funcMode">KeysightMeasMode</param>
|
||||
/// <returns>true if connected, false if not</returns>
|
||||
public bool InitDMM53220A(string address, KeysightMeasMode funcMode)
|
||||
{
|
||||
try
|
||||
@@ -73,7 +87,11 @@ namespace Testrong.User.Program
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get DMM Measured Data
|
||||
/// </summary>
|
||||
/// <param name="count">count</param>
|
||||
/// <returns>ReturnReadings()</returns>
|
||||
public double GetDmm53220AMeasureData(int count = 1)
|
||||
{
|
||||
if (!Globals.connected)
|
||||
@@ -85,8 +103,12 @@ namespace Testrong.User.Program
|
||||
}
|
||||
|
||||
|
||||
//bool GlobalSetup = false;
|
||||
|
||||
/// <summary>
|
||||
/// Setup DMM
|
||||
/// </summary>
|
||||
/// <param name="funcMode">KeysightMeasMode</param>
|
||||
/// <returns>SendCmd(text) if Success, false if Failed</returns>
|
||||
private bool Setup(KeysightMeasMode funcMode)
|
||||
{
|
||||
try
|
||||
@@ -96,47 +118,27 @@ namespace Testrong.User.Program
|
||||
text += "*CLS\n";
|
||||
text += "STAT:PRES\n";
|
||||
text += "CONF:FREQ\n";
|
||||
//switch (funcMode)
|
||||
//{
|
||||
// case KeysightMeasMode.FREQ:
|
||||
// {
|
||||
// //text += "TRIG:COUN 1\n";
|
||||
// //text += "SAMP:COUN 10\n";
|
||||
// //text += "INIT\n";
|
||||
// }
|
||||
// break;
|
||||
// default:
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
text += "INP:COUP DC\n";
|
||||
//text += "INP:NREJ ON\n";
|
||||
text += "INP:LEV 2\n";
|
||||
text += "INP:SLOP NEG\n";
|
||||
//text += "INP:LEV 10\n";
|
||||
text += "SYST:BEEP:STAT OFF\n";
|
||||
text += "FREQ:GATE:SOUR TIME\n";
|
||||
text += "FREQ:GATE:TIME .0001\n";
|
||||
text += "TRIG:SOUR BUS\n";
|
||||
text += "TRIG:COUN 100000\n";
|
||||
text += "SAMP:COUN 1\n";
|
||||
//text += "INP:LEV:AUTO ON\n";
|
||||
|
||||
//text += "SAMP:COUN 2\n";
|
||||
//text += "TRIG:DEL .01\n";
|
||||
text += "INIT\n";
|
||||
//GlobalSetup = true;
|
||||
//PresentMode = funcMode;
|
||||
return SendCmd(text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return DMM Readings
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private double ReturnReadings()
|
||||
{
|
||||
string text = "";
|
||||
@@ -182,6 +184,11 @@ namespace Testrong.User.Program
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send CMD to DMM
|
||||
/// </summary>
|
||||
/// <param name="Cmds">CMD String</param>
|
||||
/// <returns></returns>
|
||||
private bool SendCmd(string Cmds)
|
||||
{
|
||||
try
|
||||
@@ -200,12 +207,20 @@ namespace Testrong.User.Program
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Close DMM Connection
|
||||
/// </summary>
|
||||
/// <returns>true</returns>
|
||||
public bool CloseDMM53220A()
|
||||
{
|
||||
Globals.errorStatus = visa32.viClose(Globals.vi);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string GetData()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(2048);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<DocumentationFile>bin\x64\Debug\UserProgram.xml</DocumentationFile>
|
||||
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -2421,3 +2421,4 @@ D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\Testr
|
||||
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\Testrong.A8AD3C05.Up2Date
|
||||
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.dll
|
||||
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.pdb
|
||||
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\bin\x64\Debug\UserProgram.xml
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user