0303-10 PID with PWM

Example Projects > 0303 PID Control > 0303-10 PID with PWM


The source files illustrating the control of a process with binary On/Off actuator in REXYGEN are located in this folder. Process is controlled with a PID controller. Analog output from PID is converted into binary format with pulse-width modulation in the block PWM.

Timing of the project

The algorithm runs each 100 milliseconds (0.1 s). See the EXEC function block,
tick x ntick0 = 0.05 x 2 = 0.1


  • REXYGEN Runtime Core must be installed and running on the target device.

Running the example

  • The *exec.mdl file is the project main file.
  • Open it with REXYGEN Studio, compile and download it to the target device.
  • Switch to Watch mode and observe the algorithm.
  • Open trend diagnostic window for the block TRND_Loop for observing proces value, manipulated variable and set point trends. You can choose the TRND_PWM for watching signals from PWM block too.
  • Change the set-point (CNR_sp) in range from 0 to 10.
  • Observe the controller action (PIDU:mv) and the process reaction (MDL_PROCESS:y) in trend TRND_Loop and PWM action in TRND_PWM.
  • Change the set-point (CNR_sp) in range from -10 to 0 and observe system behavior again.


Additional information

  • Visit the REXYGEN webpage for more information about the example projects and developing advanced automation and control solutions using REXYGEN.