martinav (Customer) asked a question.

SET/RST not working the same in two different places, exact same method

Perhaps my method is flawed. If so, please correct. I'm sure it is in some way. Obviously, because it doesnt work the same way twice.

 

Scenario.

 

Two different bits. MC24, MC30. One SET, and one RST for each. MC24 works fine, MC30 does not RST. I got nuthin. Bits are not acted upon anywhere else in this or any other program. I did a search to be sure.

 

2021-05-13 08_20_36-Window 

2021-05-13 08_20_18-Window2021-05-13 08_20_03-Window 

2021-05-13 08_19_50-Window 

 

 

 


  • HOST_BobO (AutomationDirect)

    Not much code in a SET or RST. it's either used elsewhere, or the containing stage or code block isn't running. I like to stick INC instructions in code to prove it runs or not.​

  • martinav (Customer)

    Yea, simple enough. Inc clicks off by 1 in each of those examples. Checked again. Nope only one SET and one RST for both these examples. Similar in every way. Still, MC30 doesnt reset.

     

    Having JMP in the same rung as the other commands, how does it know which to do first? Does it JMP before the RST? I have not seen that to be the case in other areas.

    • HOST_BobO (AutomationDirect)

      If you think it isn't working, and the code appears to be executed, latch the value of that bit into another location. Use MATH, for instance, to store​ Its value immediately after the SET.

      J​MP doesn't really jump. It enables the next stage and disables the current one. Remaining code in the stage executes after JMP.

      The​ most common issue is it's either used elsewhere, or you are flowing from SET stage to RST stage and you don't realize it.

      In very rare cases there have been bugs that caused an instruction to get skipped. The best way to prove that is putting an INC at the same address as the SET is.​

      Expand Post
  • Bolt (Customer)

    Being an MC bit, Modbus Coil, are you sure it's not being written to by another device?

    What happens when you replace the MC30 bits with C2030?

  • Bolt (Customer)

    Also, SET MC30 is functionally indentical to COPY 1 MC30 (or MOVE, or MATH), and RST is functionally indentical to COPY 0 MC30. Could replace the SET/RST instructions with that as a sanity check.

     

    You should also remove the duplicate JMP SG12 instructions on rung 32 while you are at it.