Set Sample Rate

Text Language Definition

procedure SetSampleRate(SampleRate:integer);

Description

The Set Sample Rate command sets the Sample Rate of the controller. The sample rate is typically 1000 Hz with a discrete time period of 1000 microseconds. Every on-board task runs every sample period. The sample rate can be changed, although it is recommended this value not be changed unless explicitly recommended by technical support. Even though the sample rate can be changed during program execution it is recommended that it be set once during initialization and that all speed and acceleration settings be made after the sample rate has been set. Changing the sample rate after Speed and Accel settings have been established can result in distorted speeds and accels. To avoid this issue it is best and simplest to choose the sample rate from the drop-down list on the Setup Tab:

The best way to avoid these issues is to set the sample rate early in the initialization process.

Escapes

If the sample rate is set to greater than 8 kHz a Parameter Out Of Range Escape Code will occur.

Examples

This example shows the proper sequence of setting the sample rate before setting the speed and acceleration settings.

Related Topics

Sample Counter
Parameter Out Of Range Escape Code