Jump to content

Elapsed time from timer show in seconds


Recommended Posts

Hi,

 

I did some code and it works partially, but I don't know where is a mistake.

 

I atttached my api.

 

The problem is on screen 2 with variables  green and pink.

Variable MI5 should shows elapsed time of timer #0, #1, #9 depends on MB1,MB2, MB3  (net 27)  - it works correct

 

On the same scrren pink value is connected to variable MI8.

Variable MI8  should shows elapsed time of timer #2, #3, #10 and depends on MB11,MB12, MB13  (net 28)

 If only one Mi5 or MI8 change values everything is correct, but when both are working displayed values are strange.

If you can test it please check it and write where is a problem.

 

 

 

 

 

Uni_ostatnie.U90

Link to comment
Share on other sites

  • MVP 2023

Thanks for posting your code.

Your program is full of the newbie error of putting multiple logical statements per network.  When you download, each net is submitted to the STL compiler and sometimes what is actually sent to the PLC is not what you intended.  Break your code into one logical statement per net - there is no limit on how many nets you can have.

If you right-click on the side of the net and select STL Quick View you can see the compiled statement list.  Everywhere you see a "!" it's a new logical statement.  Your net 27 has three.  This is not good programming form in UnitronicsLand.

image.png.d56d824354fbc465779c0f254da66fcb.png

 

 

I have separated your nets 27 and 28 to show what I mean.  I don't have a unit handy to test it so you'll have to let us know if it worked properly.

Go back through your program and break the rest of it up as I have shown.  

Joe T.

 

Uni_ostatnie JT.U90

Link to comment
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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.