Add Comments & Bug fixes

This commit is contained in:
YuYang Shen
2025-03-21 15:36:43 +08:00
parent fc2d8e9fcb
commit 4b70eeaedb
13 changed files with 607 additions and 471 deletions
Binary file not shown.
@@ -5,13 +5,6 @@
{ {
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" "RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
},
{
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|D:\\WORK\\ManLin\\Verify\\UserProgram_time\\testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -21,34 +14,12 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 3, "SelectedChildIndex": 1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}, },
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "NLog.config",
"DocumentMoniker": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ToolTip": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ViewState": "AQIAADgAAAAAzszMzMwgwE8AAAAjAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
"WhenOpened": "2024-07-10T10:20:55.074Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "Keysight53220A.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\Keysight53220A.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeToolTip": "Testrong.User.Program\\Keysight53220A.cs",
"ViewState": "AQIAAHMAAAAAAAAAAAAYwKkAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.62Z"
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
@@ -57,7 +28,7 @@
"RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs", "RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs", "ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeToolTip": "Testrong.User.Program\\UserProgram.cs", "RelativeToolTip": "Testrong.User.Program\\UserProgram.cs",
"ViewState": "AgIAALsEAAAAAAAAAAAQwNAEAAA6AAAAAAAAAA==", "ViewState": "AgIAAEEEAAAAAAAAAAAIwGAEAAAdAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.78Z", "WhenOpened": "2024-06-18T12:27:43.78Z",
"EditorCaption": "" "EditorCaption": ""
@@ -5,13 +5,6 @@
{ {
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", "AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|d:\\work\\manlin\\verify\\userprogram_time\\testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" "RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\userprogram.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config||{FA3CD31E-987B-443A-9B81-186104E8DAC1}"
},
{
"AbsoluteMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|D:\\WORK\\ManLin\\Verify\\UserProgram_time\\testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{E96B1A19-D109-4F67-B1AA-5BF15E580D77}|Testrong.User.Program\\Testrong.User.Program.csproj|solutionrelative:testrong.user.program\\keysight53220a.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
} }
], ],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
@@ -21,43 +14,21 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 3, "SelectedChildIndex": 1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
}, },
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "NLog.config",
"DocumentMoniker": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ToolTip": "C:\\ProgramData\\Testrong\\ATE_Tester\\setting\\NLog.config",
"ViewState": "AQIAADgAAAAAzszMzMwgwE8AAAAjAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000601|",
"WhenOpened": "2024-07-10T10:20:55.074Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"Title": "Keysight53220A.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\Keysight53220A.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\Keysight53220A.cs",
"RelativeToolTip": "Testrong.User.Program\\Keysight53220A.cs",
"ViewState": "AQIAAHMAAAAAAAAAAAAYwKkAAAAiAAAA",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.62Z"
},
{ {
"$type": "Document", "$type": "Document",
"DocumentIndex": 0, "DocumentIndex": 0,
"Title": "UserProgram.cs", "Title": "UserProgram.cs",
"DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs", "DocumentMoniker": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs", "RelativeDocumentMoniker": "Testrong.User.Program\\UserProgram.cs",
"ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs*", "ToolTip": "D:\\WORK\\ManLin\\Verify\\UserProgram_time\\Testrong.User.Program\\UserProgram.cs",
"RelativeToolTip": "Testrong.User.Program\\UserProgram.cs*", "RelativeToolTip": "Testrong.User.Program\\UserProgram.cs",
"ViewState": "AgIAAEsGAAAAAAAAAAAowFcGAAAAAAAAAAAAAA==", "ViewState": "AgIAAMwDAAAAAAAAAAAmwOoDAAAyAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-06-18T12:27:43.78Z", "WhenOpened": "2024-06-18T12:27:43.78Z",
"EditorCaption": "" "EditorCaption": ""
+2 -2
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.30320.27 VisualStudioVersion = 17.13.35806.99 d17.13
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testrong.User.Program", "Testrong.User.Program\Testrong.User.Program.csproj", "{E96B1A19-D109-4F67-B1AA-5BF15E580D77}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testrong.User.Program", "Testrong.User.Program\Testrong.User.Program.csproj", "{E96B1A19-D109-4F67-B1AA-5BF15E580D77}"
EndProject EndProject
+42 -27
View File
@@ -11,8 +11,14 @@ using Testrong.User.Program;
namespace Testrong.User.Program namespace Testrong.User.Program
{ {
/// <summary>
/// Keysight53220A Related
/// </summary>
public class Keysight53220A public class Keysight53220A
{ {
/// <summary>
/// Global variables
/// </summary>
public class Globals public class Globals
{ {
public static int videfaultRM; public static int videfaultRM;
@@ -24,14 +30,22 @@ namespace Testrong.User.Program
public static bool connected; public static bool connected;
} }
/// <summary>
/// KeysightMeasMode
/// </summary>
public enum KeysightMeasMode public enum KeysightMeasMode
{ {
FREQ, FREQ,
INIT 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) public bool InitDMM53220A(string address, KeysightMeasMode funcMode)
{ {
try try
@@ -73,7 +87,11 @@ namespace Testrong.User.Program
return false; return false;
} }
} }
/// <summary>
/// Get DMM Measured Data
/// </summary>
/// <param name="count">count</param>
/// <returns>ReturnReadings()</returns>
public double GetDmm53220AMeasureData(int count = 1) public double GetDmm53220AMeasureData(int count = 1)
{ {
if (!Globals.connected) 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) private bool Setup(KeysightMeasMode funcMode)
{ {
try try
@@ -96,47 +118,27 @@ namespace Testrong.User.Program
text += "*CLS\n"; text += "*CLS\n";
text += "STAT:PRES\n"; text += "STAT:PRES\n";
text += "CONF:FREQ\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:COUP DC\n";
//text += "INP:NREJ ON\n";
text += "INP:LEV 2\n"; text += "INP:LEV 2\n";
text += "INP:SLOP NEG\n"; text += "INP:SLOP NEG\n";
//text += "INP:LEV 10\n";
text += "SYST:BEEP:STAT OFF\n"; text += "SYST:BEEP:STAT OFF\n";
text += "FREQ:GATE:SOUR TIME\n"; text += "FREQ:GATE:SOUR TIME\n";
text += "FREQ:GATE:TIME .0001\n"; text += "FREQ:GATE:TIME .0001\n";
text += "TRIG:SOUR BUS\n"; text += "TRIG:SOUR BUS\n";
text += "TRIG:COUN 100000\n"; text += "TRIG:COUN 100000\n";
text += "SAMP:COUN 1\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"; text += "INIT\n";
//GlobalSetup = true;
//PresentMode = funcMode;
return SendCmd(text); return SendCmd(text);
} }
catch (Exception) catch (Exception)
{ {
return false; return false;
} }
//return true;
} }
/// <summary>
/// Return DMM Readings
/// </summary>
/// <returns></returns>
private double ReturnReadings() private double ReturnReadings()
{ {
string text = ""; 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) private bool SendCmd(string Cmds)
{ {
try try
@@ -200,12 +207,20 @@ namespace Testrong.User.Program
} }
} }
/// <summary>
/// Close DMM Connection
/// </summary>
/// <returns>true</returns>
public bool CloseDMM53220A() public bool CloseDMM53220A()
{ {
Globals.errorStatus = visa32.viClose(Globals.vi); Globals.errorStatus = visa32.viClose(Globals.vi);
return true; return true;
} }
/// <summary>
///
/// </summary>
/// <returns></returns>
private string GetData() private string GetData()
{ {
StringBuilder stringBuilder = new StringBuilder(2048); StringBuilder stringBuilder = new StringBuilder(2048);
@@ -22,6 +22,8 @@
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin\x64\Debug\UserProgram.xml</DocumentationFile>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>bin\x64\Release\</OutputPath>
File diff suppressed because it is too large Load Diff
Binary file not shown.
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\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.dll
D:\WORK\ManLin\Verify\UserProgram_time\Testrong.User.Program\obj\x64\Debug\UserProgram.pdb 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.