Host Engineering Forum

General Category => CTRIO and CTRIO2 => Topic started by: mgibbons on July 22, 2008, 12:48:05 AM

Title: CTRIO as motion controller?
Post by: mgibbons on July 22, 2008, 12:48:05 AM
Hi all:

This is my first post, but I might as well jump right in with an application question.  By way of background, I've been using AD PLCs for several years, but have never used a CTRIO.

The system hardware I've assembled is a DL05 with an H0-CTRIO connected to a stepper drive and motor.  The application is a sort of "brute force" motion controller: the intent is to maintain the gap between a stationary surface and a moving part controlled by the stepper. The PLC has a pair of inputs that represent "Too Far" and "Too Close" in terms of the gap.  The idea is to move the stepper in the appropriate direction to maintain the desired gap, i.e., both inputs are ideally off.  The stepper moves required at any given time are very small, literally about 5-10 steps forward or backward, as necessary.

OK, so now for the question: the process requires knowledge of the moving part's position relative to a zero point that is defined when the process begins.  A traditional servo or stepper motion controller does this as a matter of course, does the CTRIO do so as well?  That is, when I tell a servo controller to Move Relative +100 counts, it automatically updates its current position without any further help from me, and when I query the controller's Current Position, I can see that it's 100 greater than last time.  Does the CTRIO do a similar thing when its outputs are configured as Step/Direction pulses?

I ran this by AD's tech support, and they indicated that it is possible, but I haven't found it in the manual yet.  I'm not looking for a shortcut to reading the manual (well, maybe a little... 8)), but I thought I'd run it by some experienced users as I get going.  If the CTRIO doesn't track its position, I guess I need to do it in PLC code by incrementing or decrementing an integer every time I make a move, does that sound right?

Thanks in advance for your help,
--Mike
Title: Re: CTRIO as motion controller?
Post by: Greg on July 22, 2008, 09:55:08 AM
Nice avatar!  :D You gotta love Franky!

If I understand your application, then all you need to do is configure the CTRIO output as you have stated (Pulse/Direction) and create a Dynamic Positioning Pulse Profile. Dynamic Positioning will allow you to simply put the absolute position (not the relative one) in a V-memory location, and set the Goto Position bit; the Pulse Output of the CTRIO will then move the stepper to the proper position.

You can "know" the absolute position in two ways:
     - Hook an encoder from the stepper to the CTRIO input and monitor it.
     - Use a System Function of the CTRIO and read the CTRIO Output count

I would also advise you to use the CTRIO IBoxes (not covered in the manual).

Summary of steps:

1. Configure CTRIO Output (Pulse/Direction).
2. Configure CTRIO Input (if you are going to use a quadrature encoder to read the position).
3. Configure Pulse Profile (Dynamic Position).
4. Configure CTRIO I/O mapping.
5. Download configuration to CTRIO.
6. In ladders, put IB-1000 (CTRIO) at top; use Help file to understand parameters.
7. Use IB-1001 (CTRLDPR) to load the Dynamic Positioning Pulse Profile.
8. Set the Enable Output bit.
9. Write the absolute position desired (signed decimal) into Parameter 3 (double word).
10. Set the Goto Position bit.

Lather. Rinse. Repeat Steps 9 & 10 as many times as you need. There is no need to relaod the table each time... that is why it is called "dynamic" positioning.

Hope this helps!