
Visit our shop for nerds in control lifestyle products.
- PC reliability?
- Windows, real time
- PID loops
- PCs vs. PLCs
- Replacing people
- MS 'monopoly'?
- Software quality
- Where do we go from here?
- Why pay?
www.control.com/rss
I have to make a program in VB 2005 that reads short values that I send from a PLC with Modbus TCP/IP.
The PLC has an IP address and also a port number.
Does somebody have a code so I can read the values in VB 2005 so I can show that on a screen and save those values?
Thanx.
Sanjay Sheth
http://rssgrinders.com/
I think I need to use this code from that side:
using (TcpClient client = new TcpClient("127.0.0.1", 502))
{
ModbusIpMaster master = ModbusIpMaster.CreateTcp(client);
// read five input values
ushort startAddress = 100;
ushort numInputs = 5;
bool[] inputs = master.ReadInputs(startAddress, numInputs);
for (int i = 0; i < numInputs; i++)
Console.WriteLine("Input {0}={1}", startAddress + i, inputs[i] ? 1 : 0);
}
// output:
// Input 100=0
// Input 101=0
// Input 102=0
// Input 103=0
// Input 104=0
And I made this:
orts System.Net
Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Module Module1
Sub Main()
Dim client As TcpClient = New TcpClient("192.168.131.44", 502)
'code for modbus
Dim startAddress As Short = 3000
Dim numInputs As Short = 100
Dim i As Integer = 0
'code for read inputs
If i < numInputs Then
Console.WriteLine("Input {0}= {1}")
'the rest of the code to write the values
Return
End If
End Sub
End Module
As you see there are a few things I can't find.
Can someone help me with the missing code?
- New, efficient industrial gas turbines coming
- What process control applications are OK for wireless?
- Enclosures: Improve NEMA designs, enclose wireless equipment, keep cabinets cool
- Affiliate integration: Advanced Automation, IAEF and EIAL become Avanceon
- Product experience: Who leads in 2008 with automation system integrators?
- Controller platform: Small-scale system bridges device gap
- Listen in: Ethanol producer adopts model predictive control to boost production
- Listen in: Gas processor to apply simulator/optimizer platform
Users of this site are benefiting from open source technologies, including PHP, PostgreSQL and Apache. Be happy.
Patronize our advertisers!



