Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
李娜
/
HuichuanLibrary
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 1c0fb29d
由
LN
编写于
2021-01-29 16:50:04 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
1
1 个父辈
136299d3
全部展开
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
31 行增加
和
151 行删除
HuichuanDLL/HuichuanLibrary.xml
HuichuanLibrary/HCBoardManager.cs
HuichuanLibrary/HCBoardManager_Axis.cs
HuichuanLibrary/HuichuanLibrary.csproj
HuichuanDLL/HuichuanLibrary.xml
0 → 100644
查看文件 @
1c0fb29
此文件的差异被折叠,
点击展开。
HuichuanLibrary/HCBoardManager.cs
查看文件 @
1c0fb29
...
...
@@ -23,9 +23,9 @@ namespace HuichuanLibrary
/// <summary>
/// 初始化配置信息,初始化板卡之前,先初始化配置
/// </summary>
/// <param name="deviceConfigPath"></param>
/// <param name="systemConfigPath"></param>
/// <param name="logName"></param>
/// <param name="deviceConfigPath">
设备配置文件
</param>
/// <param name="systemConfigPath">
系统配置文件
</param>
/// <param name="logName">
日志名称
</param>
public
static
void
InitConfig
(
string
deviceConfigPath
=
""
,
string
systemConfigPath
=
""
,
string
logName
=
"RollingLogFileAppender"
)
{
if
(
deviceConfigPath
.
Equals
(
""
))
...
...
@@ -64,7 +64,7 @@ namespace HuichuanLibrary
/// 初始化板卡
/// </summary>
/// <param name="blockFlag">是否阻塞,1=阻塞,0=不阻塞</param>
/// <returns></returns>
/// <returns>
true=成功
</returns>
public
static
bool
OpenCard
(
int
blockFlag
=
0
)
{
try
...
...
@@ -289,146 +289,6 @@ namespace HuichuanLibrary
}
//public static bool OpenCard()
//{
// try
// {
// if (CardIsOk)
// {
// return true;
// }
// if (IsInScanECAT)
// {
// return false ;
// }
// DateTime startTime = DateTime.Now;
// if (!File.Exists(DeviceConfigPath))
// {
// HCLogUtil.error("InitCard FAIL, 【" + DeviceConfigPath + "】not exists");
// return false;
// }
// if (!File.Exists(SystemConfigPath))
// {
// HCLogUtil.error("InitCard FAIL, 【" + SystemConfigPath + "】not exists");
// return false;
// }
// //【1】获取卡
// Int32 nCardNum = 0;
// UInt32 ret = ImcApi.IMC_GetCardsNum(ref nCardNum);
// if (ret != 0)
// {
// ShowErrorLog(" GetCardsNum FAIL, ErrorCode=0x" + ret.ToString("x8"));
// return false;
// }
// else
// {
// if (nCardNum <= 0)
// {
// ShowErrorLog(" Not Find Card");
// return false;
// }
// else
// {
// ShowLog("GetCardsNum = " + nCardNum + ", 将默认打开第0号卡");
// }
// }
// //【2】打开卡句柄
// ret = ImcApi.IMC_OpenCardHandle(nCardNo, ref nCardHandle);
// if (ret != 0)
// {
// ShowErrorLog(" OpenCardHandle FAIL, ErrorCode=0x" + ret.ToString("x8"));
// return false;
// }
// else
// {
// ShowLog("OpenCardHandle OK");
// }
// //【3】下载设备参数
// ret = ImcApi.IMC_DownLoadDeviceConfig(nCardHandle, DeviceConfigPath);
// if (ret != 0)
// {
// ShowErrorLog(" DownLoadDeviceConfig FAIL, ErrorCode=0x" + ret.ToString("x8") + ",请检查是否有" + DeviceConfigPath + "文件");
// return false;
// }
// else
// {
// ShowLog("DownLoadDeviceConfig OK");
// }
// //【4】启动主站
// ShowLog("Begin ScanCardECAT... ...");
// uint masterStatus = 0;
// ret = ImcApi.IMC_GetECATMasterSts(nCardHandle, ref masterStatus);
// if (ret != 0)
// {
// ShowErrorLog(" GetECATMasterSts FAIL, ErrorCode=0x" + ret.ToString("x8"));
// return false;
// }
// else
// {
// if (masterStatus != ImcApi.EC_MASTER_OP)
// {
// ret = ImcApi.IMC_ScanCardECAT(nCardHandle, 1); //默认阻塞式启动EtherCAT
// if (ret != 0)
// {
// ShowErrorLog(" ScanCardECAT FAIL, ErrorCode=0x" + ret.ToString("x8"));
// return false;
// }
// }
// }
// ShowLog("ScanCardECAT OK");
// //【5】下载系统参数
// ret = ImcApi.IMC_DownLoadSystemConfig(nCardHandle, SystemConfigPath);
// if (ret != 0)
// {
// ShowErrorLog(" DownLoadSystemConfig FAIL, ErrorCode=0x" + ret.ToString("x8") + ",请检查是否有" + SystemConfigPath + "文件");
// return false;
// }
// else
// {
// ShowLog("DownLoadSystemConfig OK");
// }
// tResource = new ImcApi.TRsouresNum();//实例化板卡外设硬件资源
// //【6】扫描卡内资源,初始化ComboBox
// ret = ImcApi.IMC_GetCardResource(nCardHandle, ref tResource);
// if (ret != 0)
// {
// ShowErrorLog(" GetCardResource FAIL, ErrorCode=0x" + ret.ToString("x8"));
// return false;
// }
// else
// {
// ShowLog("Axis [" + tResource.axNum + "],DI [" + tResource.diNum + "],DO [" + tResource.doNum + "]");
// //轴
// AxisList = new List<int>();
// if (tResource.axNum > 0)
// {
// for (int i = 0; i < tResource.axNum; i++)
// {
// AxisList.Add(i);
// }
// }
// CardIsOk = true;
// TimeSpan span = DateTime.Now - startTime;
// ShowLog("OpenCard end ," + Convert.ToDateTime(span.ToString()).ToString("HH:mm:ss"));
// return true;
// //IO
// }
// }
// catch (Exception ex)
// {
// ShowErrorLog(ex.ToString());
// }
// return false;
//}
...
...
@@ -466,8 +326,8 @@ namespace HuichuanLibrary
/// <summary>
/// 板卡是否已经初始化OK
/// </summary>
/// <param name="isShowLog"></param>
/// <returns></returns>
/// <param name="isShowLog">
未初始化完成时是否打印日志
</param>
/// <returns>
true=OK
</returns>
public
static
bool
CardInitOk
(
bool
isShowLog
=
false
)
{
if
(
CardIsOk
)
...
...
@@ -484,7 +344,10 @@ namespace HuichuanLibrary
}
}
/// <summary>
/// 紧急停止
/// </summary>
/// <returns></returns>
public
static
bool
EmgStop
()
{
if
(!
CardInitOk
())
...
...
@@ -504,7 +367,10 @@ namespace HuichuanLibrary
return
true
;
}
}
/// <summary>
/// 取消急停
/// </summary>
/// <returns></returns>
public
static
bool
CancelEmg
()
{
if
(!
CardInitOk
())
...
...
@@ -529,7 +395,12 @@ namespace HuichuanLibrary
#
region
IO
控制
/// <summary>
/// 按位设置DO的值
/// </summary>
/// <param name="bitNo">DO索引,从0开始</param>
/// <param name="bitValue">DO值</param>
/// <returns></returns>
public
static
bool
SetBitDO
(
short
bitNo
,
short
bitValue
)
{
if
(!
CardInitOk
())
...
...
@@ -545,7 +416,11 @@ namespace HuichuanLibrary
}
return
true
;
}
/// <summary>
/// 按位获取DO的值
/// </summary>
/// <param name="bitNo">DO索引,从0开始</param>
/// <returns></returns>
public
static
short
GetBitDO
(
short
bitNo
)
{
if
(!
CardInitOk
())
...
...
@@ -563,7 +438,11 @@ namespace HuichuanLibrary
return
bitValue
;
}
/// <summary>
/// 按位获取DI的值
/// </summary>
/// <param name="bitNo">DI索引,从0开始</param>
/// <returns></returns>
public
static
short
GetBitDI
(
short
bitNo
)
{
if
(!
CardInitOk
())
...
...
HuichuanLibrary/HCBoardManager_Axis.cs
查看文件 @
1c0fb29
此文件的差异被折叠,
点击展开。
HuichuanLibrary/HuichuanLibrary.csproj
查看文件 @
1c0fb29
...
...
@@ -21,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\HuichuanLibrary.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论