Part-Speed PSO Fixed Distance Pulse Output
See Part-Speed PSO Functions for more information.
Before you program Part-Speed PSO, read the information that follows.
-
The pulse generator output of the pulse stream has a maximum output rate of 95 MHz. The CountsPerUnit Parameter and programmed vector speed of the virtual axes determine the pulse stream output rate. To calculate the maximum allowable programmed vector speed, use the equation that follows.
where CountsPerUnit is the number of scaled encoder counts per user unit set by the $inputScaleFactors argument of the DrivePulseStreamConfigure() function.
-
When you use the CountsPerUnit Parameter, the user counts for the PSO axis must equal an integer. In the example program, the UnitsToCounts() Function converts the user units of the virtual axis to counts. If one user unit is equal to 1000 counts, you must program the PSO to fire at a minimum of 0.001 user units. The PSO cannot fire at intervals that are not an integer multiple of one count.
// Part-Speed PSO Fixed Distance Pulse Output Example (Part-SpeedPsoFixedDistancePulseOutput.ascript): // Shows how to generate a sequence of pulses on the real axis each time the virtual axis moves a fixed distance. // To help you visualize the behavior of the PSO output generated by this configuration, the pulse times used in this program are // longer than would be typical and this program triggers data collection. You can use the Data Visualizer to collect the // "OutputActive" bit of the "Pso Status" signal from the real axis and the Position Command signal from the virtual axes. To see // the complete output from this program, you must collect data at a period of 1 msec and a time to collect of at least 5000 msec. program var $realAxis as axis = X var $virtualAxis as axis = x // Set incremental mode. SetupTaskTargetMode(TargetMode.Incremental) // Enable and home the axis. Enable($virtualAxis) Home($virtualAxis) // Configure the virtual encoder counts generated by the "virtual" axes to pass to the // counter of the "real" axis. This is necessary because the "real" axis will generate // the PSO pulses. DrivePulseStreamOff($realAxis) DrivePulseStreamConfigure($realAxis, [$virtualAxis], [1.0]) DrivePulseStreamOn($realAxis) // Reset all PSO configuration. PsoReset($realAxis) // Configure the PSO distance module to track Drive Pulse Stream on the "real" axis. PsoDistanceConfigureInputs($realAxis, [PsoDistanceInput.XC4DrivePulseStream]) // Configure the distance module to generate an event every 10 user units. PsoDistanceConfigureFixedDistance($realAxis, Round(UnitsToCounts($virtualAxis, 10))) // Enable the distance counter. PsoDistanceCounterOn($realAxis) // Enable distance events. PsoDistanceEventsOn($realAxis); // Configure the waveform module in pulse mode: 20 ms total time, 10 ms on time (50% duty cycle), 3 periods per event. PsoWaveformConfigureMode($realAxis, PsoWaveformMode.Pulse) PsoWaveformConfigurePulseFixedTotalTime($realAxis, 20000) PsoWaveformConfigurePulseFixedOnTime($realAxis, 10000) PsoWaveformConfigurePulseFixedCount($realAxis, 3) PsoWaveformApplyPulseConfiguration($realAxis) PsoWaveformOn($realAxis) // Select the waveform module output as the PSO output source. PsoOutputConfigureSource($realAxis, PsoOutputSource.Waveform) // Select the auxiliary marker as the PSO output pin. //PsoOutputConfigureOutput($realAxis, PsoOutputPin.XC4AuxiliaryMarkerSingleEnded) // Trigger Data Collection. AppDataCollectionSnapshot() // Move the axis 35 units, expecting 3 events to occur. MoveLinear($virtualAxis, 35) // Wait for the axis to be in position and then disable the axis. WaitForInPosition($virtualAxis) Dwell(0.01) Disable($virtualAxis) // Stop Data Collection. AppDataCollectionStop() end