Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Inconsistent GPIO Output pulse from motion program
#1
Hello,

We are using a motion program to increment motor positions and then send out a trigger pulse from the GPIO at each new position (a step scan, triggering a detector at each step)

Generally this works well, but we have noticed that we occasionally have missing trigger pulses. eg If I run a 5000 point scan I may only see 4996 triggers from the GPIO.

When I monitor the output I see that occasionally a trigger pulse is remaining high for over 2.5 times longer than usual, enough time to cause the next rising edge to be ineffectual. ie - the pulses we are missing are being swallowed up by the previous trigger remaining high for too long.

This appears to happen at random - there is no apparent periodicity to these long pulses and I can get a different number of them per scan (although typically in the order of about 4-10 per 5000 points)

Below is the way we have structured our motion program:

#define TRIGGER_OUTPUT Acc65E[0].DataReg[3].3

open prog 11

WHILE(COUNTER < NUM_STEPS)
{
CALL SENDTRIGGER;
COUNTER = COUNTER + 1;
DWELL 10;
}

RETURN;
CLOSE

OPEN SUBPROG SENDTRIGGER
X(X_MOVE);
DWELL0;
TRIGGER_OUTPUT == 1;
DWELL(DWELL_TIME/2);
TRIGGER_OUTPUT == 0;
DWELL(DWELL_TIME/2);
RETURN;

CLOSE

What could be causing the random long pulses?

Is there a better, more reliable way to trigger GPIO outputs for this type of task?

Thanks for any guidance,

James
Reply
#2
The Position Compare feature would be more reliable for this, although its output comes from a dedicated connector, not from GPIO. See "Hardware Position-Compare Functions" starting on page 789 of the PPMAC User's Manual. It allows for digital outputs to be toggled at the exact programmed encoder count and will not miss any as the comparison is performed in hardware, not software.

You just have to program your on/off positions (CompareA/CompareB) before you move to the "on" position. If you have uneven spacing, you have to set each one up beforehand. A common practice is to precompute all of the on/off positions, load them into Sys.IData[] elements beforehand and load them in to the CompareA/CompareB registers as you reach each position. This can be done in a simple subprogram call or you can use the capture-compare interrupt service routine (ISR) to do this.

If you have even spacing, you can set up auto-increment, and PMAC automatically toggles the output as your motor counts pass through the preset spacing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)