XVal stays on

I have an output (doRight) in my strategy that turns on through Optoscript, but will not turn off after a call to “doRight= 0”.

Below is the code:

For fTemp_Val = 0 to (fRight_Input_Val * 1000 / fX_Axis_Scale) Step 1
fRight_On_disp = fTemp_Val * fX_Axis_Scale / 1000;

If (IsVariableTrue(iE_Stop_Stat)) Then
iMotion_Off = 0;
StartChart(E_Stop);
fRight_Input_Val = 0;
fTemp_Val = 0;
fTemp_Val = fRight_On_disp * (iHome_Direction_Multiplier);
fX_Absolute_Pos = fX_Absolute_Pos + fTemp_Val;
fTemp_Val = 0;
fLeft_On_disp = 0;
StopChart(Right);
EndIf

iAxis_In_Motion = 1;
doRight = 1;
DelayMSec(1);
Next

doRight = 0;

The Optoscript turns the IVal on and off properly but will only turn the XVal on not off.

I’m using an Enet D64 brain and a PAC Sim, Pac Control and Pack Design.

Hmm, weird that the IVAL is going on & off but the XVal only does the on part. Here’s what I would try (also remember support is FREE!):

  1. Change your “doRight = 0” to “TurnOff(doRight)” and see if that makes a difference.

  2. See if you can change that XVAL on/off in the debugger (make sure your strategy is stopped when you do that, to make sure no other parts of the strategy might be confusing things).

  3. Confirm that the digital point in question shows up in PAC Manager as an “output.”

I’m hoping you report back here what you learn!

Thanks,
-OptoMary

  1. Change your “doRight = 0” to “TurnOff(doRight)” and see if that makes a difference.
    I did this and still the same results.

  2. See if you can change that XVAL on/off in the debugger (make sure your strategy is stopped when you do that, to make sure no other parts of the strategy might be confusing things).
    I did this and I can change the results without any problem.

  3. Confirm that the digital point in question shows up in PAC Manager as an "output."
    Digital point is listed as an output in PAC Manager and I can turn it on and off from the PAC Manager as well.

I forgot to mention that all the outputs behave the same way in debug mode.
Everything seems to work fine if I “step into” the TurnOff(doRight) command.

Perhaps it [I]does [/I]go off very briefly but then loops back around to your code that turns it on (I see you have a short delay after the “turn on” part, but not after the “turn off” part), so you’re not seeing that happen when you let the logic run at full speed?

Typically this TYPE of symptom usually works out to be something like that (another program or piece of logic is also writing to that output at the same time).

Our support team have loads of experience helping people sort through these kinds of issues (and it’s free!) so I’d strongly recommend you contact them if you’re still having trouble.

Hi OptoMary,

I tried to recreate this with just 1 chart and 1 simple delay. I still got the same results so I talked to Julio in your support center and we determined that the firmware on the D64 was too old. I downloaded the newest version and all is well. Thanks to all of you for you help. Opto 22 is a great company.

Andre Barclay