剥离 HSI_Sevenocean_EF3 工程

This commit is contained in:
2022-09-02 19:05:31 +08:00
parent 713ac18866
commit 4eb7477f98
199 changed files with 131676 additions and 758 deletions
+25 -24
View File
@@ -30,16 +30,16 @@ namespace ACS_DotNET_Library_Advanced_Demo
private bool m_bConnected = false;
// For update values
private MotorStates m_nMotorState;
private ProgramStates m_nProgramState;
private MotorStates m_nMotorState; //运动状态
private ProgramStates m_nProgramState; //程序状态
private object m_objReadVar = null;
private Array m_arrReadVector = null;
private double m_lfRPos, m_lfFPos, m_lfPE, m_lfFVEL;
private double m_lfRPos, m_lfFPos, m_lfPE, m_lfFVEL; //参考位置,反馈位置 位置误差 反馈速度 double类型
private int m_nValues, m_nOutputState;
private Label[] m_lblLeftLimit;
private Label[] m_lblRightLimit;
private Label[] m_lblLeftLimit; //左限位
private Label[] m_lblRightLimit;//右限位
private Label[] m_lblInput;
private Label[] m_lblOutput;
private Button[] m_btnOutput;
@@ -48,9 +48,9 @@ namespace ACS_DotNET_Library_Advanced_Demo
{
InitializeComponent();
_ACS = new Api();
_ACS = new Api(); //初始化 ACS运动控制类
// Register Event
// Register Event 注册时间
_ACS.PHYSICALMOTIONEND += _ACS_PHYSICALMOTIONEND;
_ACS.PROGRAMEND += _ACS_PROGRAMEND;
}
@@ -62,7 +62,7 @@ namespace ACS_DotNET_Library_Advanced_Demo
btnOpen.Enabled = true;
btnClose.Enabled = false;
m_lblLeftLimit = new Label[MAX_UI_LIMIT_CNT];
m_lblLeftLimit = new Label[MAX_UI_LIMIT_CNT]; //左限位
m_lblLeftLimit[0] = lblLL0;
m_lblLeftLimit[1] = lblLL1;
m_lblLeftLimit[2] = lblLL2;
@@ -72,7 +72,7 @@ namespace ACS_DotNET_Library_Advanced_Demo
m_lblLeftLimit[6] = lblLL6;
m_lblLeftLimit[7] = lblLL7;
m_lblRightLimit = new Label[MAX_UI_LIMIT_CNT];
m_lblRightLimit = new Label[MAX_UI_LIMIT_CNT];//有限位
m_lblRightLimit[0] = lblRL0;
m_lblRightLimit[1] = lblRL1;
m_lblRightLimit[2] = lblRL2;
@@ -220,7 +220,8 @@ namespace ACS_DotNET_Library_Advanced_Demo
/// <summary>
/// Terminate connections from SPiiPlus User Mode Driver
/// - Maximum connections up to 10 in UMD
/// 终止来自 SPiiPlus 用户模式驱动程序的连接
/// - Maximum connections up to 10 in UMD
/// </summary>
private void TernminateUMD_Connection()
{
@@ -289,32 +290,32 @@ namespace ACS_DotNET_Library_Advanced_Demo
m_nMotorState = _ACS.GetMotorState((Axis)iAxisNo);
// Returned value is integer, you need to use bitmaks
if ((m_nMotorState & MotorStates.ACSC_MST_MOVE) != 0) lblMoving.Image = Properties.Resources.On; else lblMoving.Image = Properties.Resources.Off;
if ((m_nMotorState & MotorStates.ACSC_MST_INPOS) != 0) lblInPos.Image = Properties.Resources.On; else lblInPos.Image = Properties.Resources.Off;
if ((m_nMotorState & MotorStates.ACSC_MST_ACC) != 0) lblAcc.Image = Properties.Resources.On; else lblAcc.Image = Properties.Resources.Off;
if ((m_nMotorState & MotorStates.ACSC_MST_ENABLE) != 0) lblEnable.Image = Properties.Resources.On; else lblEnable.Image = Properties.Resources.Off;
if ((m_nMotorState & MotorStates.ACSC_MST_MOVE) != 0) lblMoving.Image = Properties.Resources.On; else lblMoving.Image = Properties.Resources.Off; // 运动中
if ((m_nMotorState & MotorStates.ACSC_MST_INPOS) != 0) lblInPos.Image = Properties.Resources.On; else lblInPos.Image = Properties.Resources.Off; // 就位
if ((m_nMotorState & MotorStates.ACSC_MST_ACC) != 0) lblAcc.Image = Properties.Resources.On; else lblAcc.Image = Properties.Resources.Off; // 加速
if ((m_nMotorState & MotorStates.ACSC_MST_ENABLE) != 0) lblEnable.Image = Properties.Resources.On; else lblEnable.Image = Properties.Resources.Off; // 使能
// Reference position
// ACSPL+ Variable : RPOS (real)
m_lfRPos = _ACS.GetRPosition((Axis)iAxisNo);
m_lfRPos = _ACS.GetRPosition((Axis)iAxisNo); // 参考位置
// Feedback position (Encoder value)
// ACSPL+ Variable : FPO (real)
m_lfFPos = _ACS.GetFPosition((Axis)iAxisNo);
m_lfFPos = _ACS.GetFPosition((Axis)iAxisNo); //反馈位置
// PE (Position Error)
// There is no function in library. We need to use ReadVariable function
m_lfPE = (double)_ACS.ReadVariable("PE", ProgramBuffer.ACSC_NONE, iAxisNo, iAxisNo);
m_lfPE = (double)_ACS.ReadVariable("PE", ProgramBuffer.ACSC_NONE, iAxisNo, iAxisNo); //位置误差
// Feedback Velocity
m_lfFVEL = (double)_ACS.ReadVariable("FVEL", ProgramBuffer.ACSC_NONE, iAxisNo, iAxisNo);
m_lfFVEL = (double)_ACS.ReadVariable("FVEL", ProgramBuffer.ACSC_NONE, iAxisNo, iAxisNo); //实际速度
txtRPOS.Text = String.Format("{0:0.0000}", m_lfRPos);
txtFPOS.Text = String.Format("{0:0.0000}", m_lfFPos);
txtPE.Text = String.Format("{0:0.0000}", m_lfPE);
txtFVEL.Text = String.Format("{0:0.0000}", m_lfFVEL);
// Program State
// Program State 运动状态
// State : Compiled, Running, Suspended, Autoroutine is running (ON syntax)
//
// ACSPL+ Variable : PST (integer)
@@ -515,7 +516,7 @@ namespace ACS_DotNET_Library_Advanced_Demo
{
try
{
_ACS.Halt((Axis)cboAxisNo.SelectedIndex);
_ACS.Halt((Axis)cboAxisNo.SelectedIndex); //使用 halt 命令减速
}
catch (Exception ex)
{
@@ -557,9 +558,9 @@ namespace ACS_DotNET_Library_Advanced_Demo
if (lfVelocity > 0) lfVelocity = lfVelocity * (-1); // Negative direction : Using - (minus) velocity
_ACS.Jog(
MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag
(Axis)cboAxisNo.SelectedIndex, // Axis number
lfVelocity // Velocity
MotionFlags.ACSC_AMF_VELOCITY, // Velocity flag 速度标志
(Axis)cboAxisNo.SelectedIndex, // Axis number
lfVelocity // Velocity
);
}
else
@@ -739,7 +740,7 @@ namespace ACS_DotNET_Library_Advanced_Demo
if (btn == null) return;
nBitNo = btn.TabIndex;
nBitNo = (0x01) << nBitNo;
nBitNo = (0x01) << nBitNo; //左移几位
if ((m_nOutputState & nBitNo) != 0)
{