Jump to content

V570 timer and cycle counter


Recommended Posts

Hello friends,

I have made a lot of projects using jazz and M90/M91 controllers.

However this is the first time i will be using a vision series model and i'm not familiar with programming using sub-routines.

I'm writing a program for a Vision 570 PLC which includes 3 different modules and 15 sub-routines totally.

Even though my program jumps from one sub-routine to another, i would like to have a timer that will work continously without being affected by a sub-routine change.

The timer's working time will depend on a user's preset value. Therefore it may stop working in the 3rd subroutine or in the 5th and so on.

Is it correct to use an accumulated timer in every subroutine? So when it leaves a subroutine it stops working and when is entering the next one begins to decrement from the retained value.

I also need to have a cycle counter where i used 0.1 second pulse and included the code in every sub-routine of the project. Is this correct?

Thanks in advance,

kikis

Link to comment
Share on other sites

hI kikis,

I believe you think the concept of programming with subroutines works the way a

linear programming language like basic or c does jumping back and forth at will

but this is not the way it is intended.

The idea behind it is that in every ladder scancycle the program always starts

at the first net, in the main Subroutine, in the main Module (this is the one highlighted)

and should end at the last net in this same subroutine

All calls to different subroutines are supposed to end with a return.

Do not for example program a wait loop jumping back 1 or more nets to wait for

a certain condition as this would create a condition that would not update inputs

and outputs and eventually trigger a watchdog timeout.

Please look at the topic "Program Sequencing" in the helpfile.

Following this general idea a part of the program that has a timer can be anywhere in

the main subroutine OR in a subroutine that is ALWAYS called from the main

subroutine (unconditional)

Think of programming in subroutines as inserting a number of ladder rungs (nets) un your

main program in a jazz controller, but keeping it neater. these rungs could always be executed (unconditional)

or only under certain circumstances (conditional) but instead of actually putting these

rungs (nets) there you have them neatly labled and stored in a subroutine.

I hope this helps.

Peter van Hoof

Link to comment
Share on other sites

I've got another one question and i hope that someone here could help me.

Project optimizer found some duplicate coils in my program.

My application demands manual, semi-auto and auto mode operation. Therefore certain Outputs are used several times in different subroutines.

These sub-routines are called conditionally and they are never running simultaneously as the machine can't be in auto and manual mode at the same time.

What's the problem with dublicated coils?

Thanks,

kikis

Link to comment
Share on other sites

  • MVP 2023

The optimizer doesn't know that the subroutines won't run at the same time. The fact is they CAN run at the same time; you're just programming them so they won't.

Using the same normal coil twice in a program is really bad form anyway. A better way is to have a separate coil for the same function in each routine and then OR them to the real output in another subroutine. This way of programming is so much easier to troubleshoot - you don't have to check which subroutine is active. Just look at the coil that's on and you'll know. The PLC doesn't weigh any more or the program run any slower if you use more coil addresses.

One of the arts of programming is writing it so someone else can figure out what you've done in case a tree falls on you or the machine gets shipped across the country or halfway around the world and you're not there when something goes wrong. Or you have to go back two years later and figure out what you were thinking.

Joe T.

Link to comment
Share on other sites

One of the arts of programming is writing it so someone else can figure out what you've done in case a tree falls on you or the machine gets shipped across the country or halfway around the world and you're not there when something goes wrong. Or you have to go back two years later and figure out what you were thinking.

Joe T

+10

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...