# Transition to Digital: Number Crunching

A Digital Signal Controller (DSC) is a single-chip, embedded controller that seamlessly integrates the control attributes of a Microcontroller (MCU) with the computational and throughput capabilities of a Digital Signal Processor (DSP) in a single core.

The dsPIC® DSC balances its outstanding MCU qualities with real DSP performance using numbers to represent physical values.

There are both advantages and disadvantages to using numbers.

- Advantages: The system can directly operate on the equations that describe the system functionality. This allows power conversion designers to use different control techniques, topologies, and modes without the need to change anything on the board, i.e., increased flexibility.

- Disadvantages: Care must be taken in using numbers because precision is not infinite (in loop controllers, fixed-point mathematics is used). The consequence of this is that overflow may be generated. Secondly, a finite interval of time is required for the unit to compute the output although it's also true that the output is generated with delay in the analog domain within the loop, e.g., from the compensator.

Several different approaches can be used to design the digital equivalent of the analog compensator (controller).

In the digital domain, it is possible to implement control techniques that are not possible to implement in the analog domain. For example:

- Direct transformation of the analog compensator transfer function to the digital version
- Proportional-Integral-Derivative (PID) approach
- State variable approach
- Direct digital synthesis
- Non-linear controllers

The next section focuses on using PID controller to describe how dsPIC DSC number crunching can be used in power conversion applications.

## PID

The PID controller is commonly used in the control loops of industrial processes. Its parameters need to be adjusted as a function of the control process and remain unchanged during normal operations. See Figure 2.

Figure 3 shows the PID equation, where e_{(t)} is the error of the system; T_{s} is the signal sampling period (instantaneous time) and K_{p}, K_{i} and K_{d} are the PID controller gains.

Figure 3 demonstrates that PID requires numerous calculations and constant parameter adjustments during operation. The dsPIC DSC's DSP engine allows fast math operations with the following features:

- High-speed 17-bit by 17-bit multiplier
- Barrel shifter
- 40-bit adder/subtractor
- Two target accumulator registers
- Rounding logic with selectable modes
- Saturation logic with selectable modes