Announcement

Collapse
No announcement yet.

BRX Help needed. XY table with Stepper motors. Need easier way to program. Help

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


  • BRX Help needed. XY table with Stepper motors. Need easier way to program. Help

    Hi everyone, New guy here to the BRX world. I by no means am a pro at PLC programming but have used the Click PLC's for a few automation needs, but the the BRX series is totally new to me. Here is what I am doing.
    I am building an XY table that is BRX controlled and moved with Stepper motors. Using AXCONFIG and Etc I have the stepper motor doing exactly what I want. Here is where I run into a problem.
    I need the "program" to run certain patterns depending on what the user is doing at the time. For example In the x axis I have the motor moving from 0 to 220000 pulses. During this motion I am using greater than and less than contacts to turn on a "y" output at various spots to run external equipment. The axis then returns to 0. This all seems to be working fine. Here is where I could really use some help:
    Now in "x" axis I want to move to a position Let's say 20000 steps, 1 rotation, then run the same "program in the Y" that I just did. once complete I would like the y axis to move 20000 more and run the "y program again"
    I know writing line for line code I can create this pattern. But I have aprox 20 different patterns to program. That is a lot of code. The total "y" axis run is always the same length 222000 pulses. The variables to the patterns will be the pulse on for the "y output" and the x movement. I have tried using a drum command to repeat the full pattern to no luck If someone could help me with a short example how to make this pattern repeat I would be forever indebted. lol Program is easier than I make it sound
    Move up y to set point return to 0
    Move x axis to set point
    Move y again same move and return
    move x axis again to set point
    Move y again and return
    Return both to home

    I have a feeling this is an easier task than I am finding information on and hope someone can show me how. Thanks Once I figure out this short example I can fine tune it for all 20 patterns.

    Thanks


  • #2
    You need a recipe system. Imagine that you have three or four consecutive V-registers. The first holds your X-coordinate, whether relative or absolute (I'd suggest absolute). The second holds the Y-coordinate. The third holds a number encoding what operation you need to perform at that location. If you need to pause before or after doing the operation, and you want the delay to be programmable by step, you could add another register to hold the time delay. Now those four registers together form a to-do list for that step. Move to X,Y, perform operation Z, wait W ms, then go on to the next step.

    You can design it to meet your needs. If you always do the same operation at all the points, then you might not need the operation ID register, for example, though you might still include it just for future flexibility. If no more than one operation is performed at a location, but there are multiple choices, you could encode them 1, 2, 3, 4, etc. If more than one operation can be performed, you can have a bitword with each bit corresponding to an operation. If there's potentially an order in which the operations must be done, then organize the bits in that order in the word/dword and execute at runtime accordingly.

    In the old days, you would have just stored your recipe steps in contiguous blocks of V-memory, but since Do-More now supports User Data Types, there's a nicer way. You can make a UDT for your recipe, which makes the code easier to follow, and gives you more flexibility in mixing data types in your recipe. You don't have to use a bitword to encode operations in that step, for example. If you prefer, you can put in a bool for each potential operation. Then if your recipe step pointer is in V0, and you have that nicknamed “StepPtr”, then you can create a data block of type RecipeStep, name the block Recipe, and the X-position for the current step is called Recipe[StepPtr].X-position, and you have Recipe[StepPtr].Operation, Recipe[StepPtr].TimeDelay, and so on.

    Make sure your logic can handle null operations, for example a step that needs an X-move but no Y-move. Now if you need path control, like you must complete the X before initiating the Y to avoid hitting some feature on the part, you can do that by separating those into two steps, and the system won't be bothered because the first move didn't have a Y, an operation, or a time delay, and the second didn't have an X.

    Now, you can make the recipes editable from the HMI. If the HMI you use has a Do-More driver, and it works with other than native data blocks, you may be able to write directly to Recipe[1].Operation. If not, use Modbus to MHR's and move that data within the PLC using ladder. When Do-More gets more deeply nested UDT's and/or n-dimension arrays, you'll be able to do Recipe[PartName].[Step].Operation and so on.

    Comment



    • #3
      ControlsGuy,

      That sounds like it will work out nicely for what I need. I have never used the recipe function in a PLC only HMI's but I think I follow your logic and it does make sense. I will do my research and let you know how I make out. Thanks for the help .

      Comment



      • #4
        Originally posted by ControlsGuy View Post
        When Do-More gets more deeply nested UDT's and/or n-dimension arrays, you'll be able to do Recipe[PartName].[Step].Operation and so on.
        I want!!!!

        Comment



        • #5
          Me too, but I shouldn't have said 'when'. I assume they'll get there eventually, but I have no knowledge of the development road map.

          Comment



          • #6
            We have long conceived a pair of recipe instructions that would read and write records to an sdcard file, as well as an import/export facility for building recipe files from DmD. We might raise the priority on that. Would significantly reduce the need for deep nesting and n-dimension arrays, and could be done fairly easily on existing code.

            Comment



            • #7
              Can't wait! However, the nested types and n-dimension arrays help with a lot of things other than recipes, so I'd still like to get those eventually.

              Comment



              • #8
                Originally posted by ControlsGuy View Post
                Can't wait! However, the nested types and n-dimension arrays help with a lot of things other than recipes, so I'd still like to get those eventually.
                And we'd like you to have them. Much harder problem without compiling, but we might still get there.

                Comment

                Working...
                X