Jump to content

Store function not working


Recommended Posts

  • MVP 2023

Moved... to appropriate forum section

Standard problems:

-- MB47 and MB50 are not activated according to the program;

-- the piece of code you wrote lies in a routine that is never called anywhere;

--there is another place in the program where variables MI97 and MI116 are overwritten with another value or initialized.

 

If possible put your code here otherwise it's hard to tell where the problem lies.

P.S. What plc are you using and how do you test your code?

 

Link to comment
Share on other sites

  • MVP 2023

and as well....

--  Split this into 2 rungs,

-- Ensure that MB50 & 47 (and perhaps any other MBs that also dictate parameters) cannot be called at the same time...only one of them (all).

Re the "routine that is never called anywhere" noted by Kratmel, read this:

Point 11 in here:  https://forum.unitronics.com/topic/6229-ongoing-24-topics-almost-worth-pinning/

cheers, Aus

Link to comment
Share on other sites

Fixed the issue. I had created a new subroutine just for that code, and I guess the program never called on that subroutine, so I moved it into the main subroutine and now it works fine. 

For future reference, how do you call up a subroutine? (I should probably read the help section 😁

  • Like 1
Link to comment
Share on other sites

On 12/14/2023 at 4:33 AM, JW0807 said:

Fixed the issue. I had created a new subroutine just for that code, and I guess the program never called on that subroutine, so I moved it into the main subroutine and now it works fine. 

For future reference, how do you call up a subroutine? (I should probably read the help section 😁

Yes 🙂
image.png

Link to comment
Share on other sites

Hi JW0807

The example above show how to call subroutines when certain conditions are met.

The best way is to call subroutines without any condition.

Just connect the call subroutine block directly to the left rail without any condition.

This way the subroutine is always called.

  • Upvote 1
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.