Thenoobs

Monitor Data using fx3u.enet.l

8 posts in this topic

I use delphi to program and connect to fx3u-enet-l using actfxenettcp component. I can connect and retrieve data using readdeviceblock2 from the plc. The problem is, If i put the readdeviceblock2 in a loop to always monitor data, it only work for 1 or 2 minutes. Then the connection close. How to monitor data in real time using actfxenettcp?

 

Operational setting:

Communication data binary. Initial timing always wait for open. Send frame ethernet. Tcp existence use the ping.

Open setting:

Protocol tcp. Opensystem unpassive. Fixed buffer read. Procedure exist. Pairing open disabled. Existence no confirm.

Share this post


Link to post
Share on other sites

I would say that there's a problem with your Delphi code, but there might be an error in MX Components of course.

Could you make a screenshot of your settings in FX-ConfiguratorEN, and a text file of a sample Delphi<->PLC program?

Share this post


Link to post
Share on other sites

The code similar to this:

Actfxenettcp.cputype := 520;

Actfxenettcp.hostport := 1300;

Actfxenettcp.timeout := 5000;

Actfxenettcp.hostip := '192.168.0.2';

If Actfxenettcp.open = 0 then timer.enabled := true;

 

Ontimer: timer interval 500

Var a: smallint;

Begin

Actfxenettcp.readdeviceblock2('D300',1,a);

Label1.caption := a.tostring;

End;

Share this post


Link to post
Share on other sites

Do you also have screenshots of the FX Configurator EN settings (all modified settings)?

Share this post


Link to post
Share on other sites

First: Try setting FX ConfiguratorEN settings as per the image.

Second: in your Delphi code you should have a break in the timer in case the conncetion is unexpected closed again (cable failure or similar) so that the connection can be reestablished at a later point.

Third (if both the above fails): What happens if you increase the timer interval? Have you tried setting it to e.g. 5 seconds as a test?

enet.png

Share this post


Link to post
Share on other sites

I notice if I put 2 or more consecutive readdeviceblock  cause the error.

If I put delay between readdeviceblock, I can manage to reduce the amount of error. 

this code gives error everytime

while 1 do

begin

readdeviceblock('X0',4,x[0]);

readdeviceblock('Y0',4,y[0]);

end;

 

this code gives error sometimes (not as much)

while 1 do

begin

readdeviceblock('X0',4,x[0]);

delay(500);

readdeviceblock('Y0',4,y[0]);

delay(500);

end;

Share this post


Link to post
Share on other sites

Did you set the comm params as in the picture?

What kind of error do you get?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now