Set the sample rate for the target application

The code runs at a timing interval established by an interrupt generated by an onboard clock. Therefore, the generated code runs at a hardware-generated clock rate. This base clock rate is set in the System > System Properties dialog box. It is important to set this rate correctly since it is used to calculate digital filter coefficients and other controller parameters. You can also change this rate in the dialog box for the Target Interface block.

If the generated code cannot keep up with the specified sample rate, you will see the following message:

Target sampling too fast

Additionally, any background idle loop tasks will be starved of CPU time and will not run.

For example, suppose you request a 10kHz sampling rate (with timer interrupts generated at 100ms), but the diagram takes 150ms to run. This means that by the time the calculation from the diagram has finished, there is already another pending interrupt and you are no longer maintaining the 10kHz rate.