.

Motor Digital Output Waits

The mpiMotorGeneralOutSet function has a Boolean argument wait. SynqNet is a cyclic network and each new state (after a call to an output function) can only be transmitted over SynqNet at the SynqNet rate. The wait argument determines what happens if two output functions are called in short succession.

When an output function is first called, the new output state is held on the controller and the function will return immediately releasing the host application to continue with other tasks. The new output state will wait on the controller until the next cycle before being transmitted over SynqNet and being applied to the physical pin on the node.

If an output function is called again for the same node before this data has been transmitted, then the wait argument selects between two choices, either wait for the previous output state to be transmitted before continuing to apply the new state or overwrite the existing held state in the controller and immediately exit.

wait
Advantage
Disadvantage
FALSE
Some output states may never appear at the output pins.
No delay is introduced into the execution of the output function.
TRUE
Guarantees that each output state in a sequence will appear at the output pins.
Adds a delay to the execution of the output function.

The maximum wait is one SynqNet cycle. The wait decision is independent for each motor on each node.

The following MPI code with wait = TRUE will ensure that the physical pin will definitely generate a short pulse.

mpiMotorGeneralOutSet( motor0, 0, 1, 1, /*wait*/ TRUE );
mpiMotorGeneralOutSet( motor0, 0, 1, 0, /*wait*/ TRUE );

The following MPI code shows the use of not introducing a wait. The code is updating two bits on the same node. Both calls will immediately exit and since the timing of these two bits (in this application) are not related, this code can execute faster.

mpiMotorGeneralOutSet( motor0, 7, 1, 1, /*wait*/ FALSE );
mpiMotorGeneralOutSet( motor0, 8, 1, 1, /*wait*/ FALSE );

You can find the SynqNet sample rate from the sampleRate field of the MPIControlConfig structure returned by the mpiControlConfigGet function.

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2010 Motion Engineering