Twincat .NET read float/REAL values

BartDM

Member
Join Date
Oct 2011
Location
Antwerp
Posts
1
Hey all,

We're trying to read values from a Beckhoff PLC that is programmed by a third party.

We see in the PLC the value Sensor_Waarde_REAL(%MD100) we are trying to read. (see image below)

When we use next solution we receive a number but not the number showed in the PLC interface. Does anyone knows the solution or who can point us in the correct direction?

TcAdsClient client = new TcAdsClient();
client.Connect(txtIpAddress.Text + ".1.1", 801);
AdsStream stream = new AdsStream(4);
BinaryReader br = new BinaryReader(stream);
client.Read(0x4020, 100, stream, 0, 4);
var valueMeasured = br.ReadSingle();
Log.DebugFormat("Value = {0}",valueMeasured );



PLC.jpg
 
Sorry for the late response. It looks like the UI code you posted is in C#. Search on this site for AdvancedHMI by Archie. It reads/sets PLC variables from VB.net, which should be identical. I have only used ADS in VB6 to date, but will move the .net on an upcoming project. It should be just a few simple calls.
 

Similar Topics

Hello, Is there any forum for the Beckhoff PLC's? I'm trying to follow an example for BACnet Building Automation where I connect a binary input...
Replies
0
Views
1,187
Hi, I am currently working on a project and I have to exchange datas between a Beckhoff TwinCat 3 CPU C6925-0010 and a AB Control Logix. I was...
Replies
1
Views
1,867
Hello, I'm currently trying to connect my vb.net application with my Twincat PLC. This is what I have so far (i call it from a sub): Dim ads As...
Replies
6
Views
4,390
Hello, I am a robotics engineering student. I have recently been put on to an older project that is driven with twincat using a beckoff PLC. Just...
Replies
2
Views
4,611
I mentioned this question in another post but i feel that it needs its' own post. I have a Beckhoff CX5010 software PLC running Windows Embedded...
Replies
1
Views
4,921
Back
Top Bottom