JLB (Customer) asked a question.

How to take input and convert to integer?

I am working the Productivity PLC programming software for the first time, learning basic programming. I am trying to recreate a program that use a MOV command (SLC 500) to place a value in a stored integer (0=OFF,1 = ON ,2 =AUTO) for status. This status is then used to set RUN,OFF,AUTO based on what the value is using a compare function. I do not see a command equivalent to the move command in the Productivity suite. I could use the MATH function and just output a constant, but that there may be an easier way. What would be the way to do this?


  • RBPLC (Customer)

    You're probably looking for the CPD (copy) command. Like MOV but allows up to (50, I think) items to be copied at once.

  • Garry (Customer)

    +1 RBPLC

    Another method would be just to set the bit in the output register that you want based on the condition.

    Example:

    Tag OnOFFAuto = 16 bit unsigned.

    You are basically setting the first two bits of the 16 bit word.

    OnOFFAuto:1 is the bit of the register tag.

    • Set this bit to 0 if OFF
    • Set this bit to 1 if On

    OnOFFAuto:2 is the second bit of the register tag.

    • Set this bit to 1 if Auto

    When you look at the tag as a whole, you will have a 0, 1 or 2.

     

    I hope this makes sense to you.

    Regards,

    Garry

     

    https://accautomation.ca/series/productivity-1000-plc/

     

    Expand Post
  • ADC_PLC_ENG (AutomationDirect)

    As mentioned above several ways to do this. Three options below. The logic below is assuming input 1 & 2 cannot be on at the same time.

     

    input to word

  • JLB (Customer)

    Thank you all, I was able to get this to work.