jaiven05 Posted November 9, 2011 Report Share Posted November 9, 2011 Hi, I should let you know right off the back that I a brand new to programming in C#. My objective in this project is to communicate to a DL05 PLC. I want to create a directNET library in C# in order to accomplish this task. From the DirectNET manual I found that In order to "Read Request" I need to first initiate request, define request, acknowledge receipt of data, finish. And in order to "Write Request" I need to initiate request, Defin Request, Transmit Data, and finish. Now, my question is: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Net.Sockets; using Modbus; namespace Ethernet { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { ushort[] clock4rmPLC = new ushort [7]; TcpClient Tcp = new TcpClient("192.168.1.100", 502 ); Modbus.Device.ModbusIpMaster myBus = Modbus.Device.ModbusIpMaster.CreateIp(Tcp); // ushort[] = memory4rmPLC; clock4rmPLC = myBus.ReadHoldingRegisters(4086, 7); //Converted Octal number to a Decimal number. Increment 4 points from 4086 } private void button2_Click(object sender, EventArgs e) { ushort[] clock4rmPLC = new ushort[7]; TcpClient Tcp = new TcpClient("192.168.1.100", 502); Modbus.Device.ModbusIpMaster myBus = Modbus.Device.ModbusIpMaster.CreateIp(Tcp); // ushort[] = memory4rmPLC; clock4rmPLC = myBus.ReadHoldingRegisters(1024, 1); //Converted Octal number to a Decimal number. Using 1024 becuase it is the decimal value of octal 2000 } } } Question: Can the code I pasted in (which is used to connect to a DL06 PLC via Modbus library in C#) be used with slight modifications? Advice is much appreciated! Quote Link to comment Share on other sites More sharing options...
Saragani Posted November 9, 2011 Report Share Posted November 9, 2011 Used with that? With DL05? I have no idea... (I'm not familiar with their products and their protocols). With Unitronics PLCs? I'm not sure....... but you have a communication driver/library that Unitronics wrote in order to communicate with their PLCs. Quote Link to comment Share on other sites More sharing options...
Damian Posted November 9, 2011 Report Share Posted November 9, 2011 Used with that? With DL05? I have no idea... (I'm not familiar with their products and their protocols). With Unitronics PLCs? I'm not sure....... but you have a communication driver/library that Unitronics wrote in order to communicate with their PLCs. Its just modbus. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.