Announcement

Collapse
No announcement yet.

Sequencing MWX commands

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TheGreatMarklar
    replied
    Originally posted by BobO View Post

    It sounds like Franj is contradicting me, but it's semantics and true in this sense. When you JMP from a stage, it does terminate the stage. In the case where a stage jumps to itself, it terminates then enables. This allows things like edge contacts to rearm.

    In the case where you jump from another stage to one already enabled, there is no re-initialization.
    Makes perfect sense, thanks.

    Starting a new thread for a question related to stage JMPs, but not the original topic.

    Leave a comment:


  • BobO
    replied
    Originally posted by franji1 View Post
    JMP back to yourself will reinitialize the stage, which is a good thing.
    It sounds like Franj is contradicting me, but it's semantics and true in this sense. When you JMP from a stage, it does terminate the stage. In the case where a stage jumps to itself, it terminates then enables. This allows things like edge contacts to rearm.

    In the case where you jump from another stage to one already enabled, there is no re-initialization.

    Leave a comment:


  • franji1
    replied
    Originally posted by TheGreatMarklar View Post
    The MWX instructions are programming a series of parameters on a remote device, so they are all the same slave.

    Also, wow. I'm still pretty new to Do-more, and this post reminds me that I'm just scratching the surface of what it can do.

    Will a JMP to a stage that's already running reinitialize that stage, or just leave it running?
    JMP back to yourself will reinitialize the stage, which is a good thing.

    You could try "kicking the tires" by using the Simulator with a new project, and sequence 18 MRX (READ) using STAGE.

    Keep your program as-is, and just try stage in another project that is running the Simulator and JUST running that one program that does 18 MRX's. Do what I said (except to MRX, NOT MWX) in the Simulator.

    Oh, and since you are doing it to the same device, the OnError could just JMP back to the same stage, i.e. keep trying to write THAT register until it works, OR have ALL of the OnError JMP back to S0 (the beginning/first register). Actually, have all the OnError JMP to SG S99, do a STREAMOUT to @UserLog, then have that JMP back to S0

    SG S99
    STRPRINT "MWX Write Error" SS0
    STREAMOUT @UserLog SS0 OnSuccess JMP S0, OnError JMP S0

    This will log a date/time stamp to user log, but it may create a WHOLE bunch of entries when an error does occur.

    It may be best to have S99 just increment an Error count (e.g. D42) that you can monitor from Designer or your HMI
    SG S99
    INC D42
    JMP S0

    Whatever behavior you think is best whenever you "pull the plug" or "power down your ethernet switch" or whatever.

    Leave a comment:


  • BobO
    replied
    Originally posted by TheGreatMarklar View Post
    Will a JMP to a stage that's already running reinitialize that stage, or just leave it running?
    There is no stage initialization per se. The stage will remain enabled.

    Leave a comment:


  • TheGreatMarklar
    replied
    The MWX instructions are programming a series of parameters on a remote device, so they are all the same slave.

    Also, wow. I'm still pretty new to Do-more, and this post reminds me that I'm just scratching the surface of what it can do.

    Will a JMP to a stage that's already running reinitialize that stage, or just leave it running?

    Leave a comment:


  • franji1
    replied
    Stage is your friend. Try it out. Stick this code in its own PROGRAM code-block.
    SG S0
    MWX1 OnSuccess JMP S1 (OnError JMP S1? JMP S99?)

    SG S1
    TMR T0 2 seconds
    STR T0.Done
    JMP S2

    SG S2
    MWX2 OnSuccess JMP S3 (OnError JMP S3? JMP S99?)


    SG S3
    TMR T1 2 seconds
    STR T1.Done
    JMP S4

    SG S4
    MWX3 OnSuccess JMP S5 (OnError JMP S5? JMP S99?)

    . . .

    When you are done, open up the Project Browser and turn status ON. Expand that code block 1 level to the Stage level and see exactly the sequence of your round-robin MWX's. Even better, stick some rung comments on these rungs and look at it in the Project Browser, with good text in the first line of the comment. Your child can understand what it's doing at runtime looking at status in the Project Browser.

    I like to use SG S99 as the "error out" stage. Maybe write something to the @UserLog, then JMP back to the beginning (S0). In this case, however, you may just want the OnSuccess and OnError to JMP to the same stage since you may have 1 slave error out, but the other slaves are fine, so you want to continue with the next slave regardless. Unless these are 18 different Modbus memory Addresses/function codes to the SAME slave, so once one fails they will probably all fail - in that case, you may want to utilize SG S99, STREAMOUT an error message to @UserLog (or send an email or whatever), then JMP S0 and try again.

    Leave a comment:


  • TheGreatMarklar
    replied
    Never mind, I forgot about Shift Registers. Much better with bitwise support!

    Leave a comment:


  • TheGreatMarklar
    started a topic Sequencing MWX commands

    Sequencing MWX commands

    I have 18 MWX commands to program a device over Modbus TCP. When the stage is enabled, each MWX needs to execute once, in order, with a 2 second delay between each. Setting each instruction to execute continuously every 2 seconds is not working. I thought maybe a DRUM instruction, but it does not have enough outputs. Any suggestions?
Working...
X