Modbus 확인:
- AdvancedHMi + C# + ESP8266
- AdvancedHMI에서 읽고 쓰고 ...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
// 2022.07.02
// 맨위의 창에서 "Any CPU" 우측에 빌드 타겟을 AdvancedHMIcs 로 변경
// Ctr+Shift+B : 프로젝트 모두 빌드하면 왼쪽 도구항목에 AdvancedHMI 컴포넌트 보임
// 그리고 c# 참조에서 추가할 것 : 자동으로 추가가 안됨 ...!!!!!
// "MfgControl.AdvancedHMI.Controls.dll" + "MfgControl.AdvancedHMI.Drivers.dll"
// 시작 Base Address = 1 : 따라서 읽을 주소에 1 추가할 것
namespace AdvancedHMICS
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
btnDisconnect.Enabled = false;
tbModbusAddess.Text = modbusTCPCom1.IPAddress.ToString();
}
private void btnConnect_Click(object sender, EventArgs e)
{
modbusTCPCom1.IPAddress = tboxIP.Text;
tbModbusAddess.Text = modbusTCPCom1.IPAddress.ToString();
btnConnect.BackColor = Color.Aqua;
btnConnect.Enabled = false;
btnDisconnect.Enabled = true;
}
private void btnDisconnect_Click(object sender, EventArgs e)
{
btnConnect.Enabled = true;
btnDisconnect.Enabled = false;
}
private void btnCoilRead_Click(object sender, EventArgs e)
{
tbCoilValue.Text = modbusTCPCom1.Read(tbCoilAddess.Text);
}
private void btnDinputRead_Click(object sender, EventArgs e)
{
tbDinputValue.Text = modbusTCPCom1.Read(tbInputAddess.Text);
}
private void btnAinputRead_Click(object sender, EventArgs e)
{
tbAinputValue.Text = modbusTCPCom1.Read(tbAnalogueAddess.Text);
}
private void btnHregRead_Click(object sender, EventArgs e)
{
tbHregValue.Text = modbusTCPCom1.Read(tnhRegAddess.Text);
}
private void btnCoilWrite_Click(object sender, EventArgs e)
{
modbusTCPCom1.Write(tbCoilAddess.Text, tbCoilValue.Text);
}
private void btnDinputWrite_Click(object sender, EventArgs e)
{
modbusTCPCom1.Write(tbInputAddess.Text, tbDinputValue.Text);
}
private void btnAinputWrite_Click(object sender, EventArgs e)
{
modbusTCPCom1.Write(tbAnalogueAddess.Text, tbAinputValue.Text);
}
private void btnHregWrite_Click(object sender, EventArgs e)
{
modbusTCPCom1.Write(tnhRegAddess.Text, tbHregValue.Text);
}
private void btnTest_Click(object sender, EventArgs e)
{
tbCoilValue.Text = modbusTCPCom1.Read("00101");
}
}
}
AdvancedHMI 다운로드 :
https://www.advancedhmi.com/index.php?main_page=index&cPath=2
참고할 곳 :
http://comfilewiki.co.kr/ko/doku.php?id=comfilepi:advancedhmi_uidriver:index
'eLectric' 카테고리의 다른 글
PLC 와 HMI : AdvancedHMI를 컴퓨터로 시뮬레이션 (0) | 2019.10.12 |
---|---|
PLC 종류 및 시뮬레이션 방법 (0) | 2019.10.12 |
오토캐드 - AutoCAD 2014 (0) | 2017.01.31 |
이글캐드 - EagleCAD : 달인/팁 (0) | 2017.01.21 |