西门子840D数控机床使用C++DDE技术连接DHServer|Result实现NC程序的管理

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dacong/article/details/79356815

西门子840D数控机床使用DHServer|Result实现NC程序的管理

参考SINUMERIK 840D/840Di HMI Programming Package Part 1 开发包。第10章Data Management

按照给的VB例子,使用C++语言的DDE直接和DHServer通讯,目前测试成功了Create,COPY等命令,在NCK中或在MMC中建立目录及文件。C++的代码不好提供。


Sub Form_Load ()
Label1.LinkTopic = ”DHServer|Result”
Label1.LinkItem = ”transStat”
Label1.LinkMode = 1  //自动热连接
Label2.LinkTopic = ”DHServer|Result”
Label2.LinkMode = 2  //手动连接
Label2.LinkExecute ”copy transStat \WKS.DIR\WELLE.WPD -n\WKS.DIR\WELLE3.WPD -m”
End Sub

transStat:是随便定义的一个变量。如果是C++语言写的控制台程序,需要获取transStat的值,其值我操作的结果进度百分比,99就算成功,大于100的表示出错。记住C++中的路径是copy transStat \\WKS.DIR\\WELLE.WPD -n\\WKS.DIR\\WELLE3.WPD -m

create命令也测试成功

Sub Form_Load ()
Label1.LinkTopic = ”DHServer|Result”
Label1.LinkItem = ”transStat”
Label1.LinkMode = 1
Label2.LinkTopic = ”DHServer|Result”
Label2.LinkMode = 2
Label2.LinkExecute ”create transStat \MPF.DIR\ WELLE MPF * -nf”

End Sub


10.4.2 Request Jobs 这种类型的都可以成功
Realization
Simple requests of data are realized as DDEML Request. They are executed synchronously.
This type of call is used for simple jobs with short execution times. The
name of the function is passed as the Topic, the argument as Item of the request.

The function get_realpath is an example of this type.


10.4.3 Simple Execute jobs
Realization
Simple jobs not returning data are realized as DDEML Execute. The result of the
call is contained in the returncode of the DDEML function. This returned value can

be either DDE_FACC, DDE_FBUSSY or DDE_FNOTPROCESSED.


Activate,Select命令目前我还没有测试成功。

DHServer|Create这种方式连接DDE没成功。下边的这句话误导了我”DHServer|” and the corresponding function name are specified as Linktopic, the arguments are specified as Linkitem as far as necessary.

展开阅读全文

没有更多推荐了,返回首页