Host Engineering Forum

General Category => CTRIO and CTRIO2 => Topic started by: benc on December 16, 2008, 09:44:58 AM

Title: H0-CTRIO Velocity Mode, Command Complete bit
Post by: benc on December 16, 2008, 09:44:58 AM
I attempted to run the H0-CTRIO velocity mode example (from the manual) in a stage program.
The velocity mode routine is in its own stage.

What I found is the command complete bit does not always set, so the program hangs indefinetly.

I added a 500ms timer, and added a rung to restart the stage if the command complete bit is not set after the timer expires.

Now, the program works, but this stage repeats several times before the command complete bit sets.  This slows the operation down too much.

I tried reducing the timer to 300ms, but the stage sometimes hangs, or the CTRIO output repeats indefinetly.

Any ideas?  Is the command complete bit set only for a short time; can it be missed if there is too many other things going on in the program?

Thank-You,
Title: Re: H0-CTRIO Velocity Mode, Command Complete bit
Post by: Greg on December 16, 2008, 05:23:23 PM
The problem with doing this in stage is that when you tell the CTRIO to do something it can take a few scans of the PLC to complete. Therefore if you set the Process Command bit, and then jump out of the Stage before that operation comes to completion (i.e. Command Complete bit comes ON), then this could cause problems depending on how you have programmed it.

If you are using DirectSOFT5, I would advise you to use the CTRIO IBoxes to accomplish this task; it is much easier. You would use:

Of course, you could eliminate the problem by executing these outside the Stage.