哇咔咔
人生似海,命運如舟,機遇如波濤般起浮不定,在關鍵的時候,自己
級別: 家園常客
|
visual stdio開發上位機和組態軟件做上位機,各自有什么優缺點?我覺得觸摸屏以及組態軟件功能已經做的挺好了啊,寫腳本也比較靈活。沒有接觸過visual stdio做上位機軟件,用過的師傅來說說唄。 |
---|---|
|
加減1生不息
自動化軟件工程師
級別: 略有小成
|
不好意思,vs也很簡單,我半年就能獨立做項目了 |
|
---|---|---|
本帖最近評分記錄:
|
加減1生不息
自動化軟件工程師
級別: 略有小成
|
using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using TwinCAT.Ads;//twincat安裝目錄中有 using System.IO; namespace HmiAdsTest { public partial class MainForm : Form { public MainForm() { InitializeComponent(); } public static TcAdsClient tcAdsClient;//建立通訊 private int handle; private void button1_Click(object sender, EventArgs e) { tcAdsClient = new TcAdsClient();//實例化 //tcAdsClient.Connect(851);//同一臺機器上使用 tcAdsClient.Connect("169.254.71.120.1.1", 851);//amsNetID 851是twincat3 端口號 try { //handle = tcAdsClient.CreateVariableHandle("IOs.ConnectSucceed"); handle = tcAdsClient.CreateVariableHandle("IOs.Dog"); MainForm.VariableAssignment.ConnectSucceed = (bool)(tcAdsClient.ReadAny(handle, typeof(bool))); tcAdsClient.DeleteVariableHandle(handle); } catch { MainForm.VariableAssignment.ConnectSucceed = false; MessageBox.Show("未能連接網絡"); } if (MainForm.VariableAssignment.ConnectSucceed) { MessageBox.Show("成功連接網絡"); button1.BackColor = Color.Green; } else { timerReadPeriod.Enabled = false; } } public class VariableAssignment { public static bool ConnectSucceed; public static int AO_ProportionalValve2Dint; } private void numericUpDown1_ValueChanged(object sender, EventArgs e) { handle = tcAdsClient.CreateVariableHandle("IOs.AO_ProportionalValve2Dint"); tcAdsClient.WriteAny(handle, (int)numericUpDown1.Value); tcAdsClient.DeleteVariableHandle(handle); } } } 這個答案你滿意嗎 |
|
---|---|---|
本帖最近評分記錄:
|