Embedded system prototyping methodology

Diagram: postion_control_embedded

Location: Examples > Fixed Point

Once the controller and control logic are simulated in scaled fixed-point, and the design issues are addressed satisfactorily, the next step is the actual implementation of the controller and control logic on target hardware.

With Embed, you can quickly and easily implement fixed-point controllers and logic on embedded targets. The embedded code can be exercised and tested by changing set points using slider blocks and observing output in plots while the actual control code is executed on the embedded target.

From a methodology point of view, the main concept that is crucial in embedded system prototyping is the principle of adequate and complete encapsulation. That is, all control, logical, input-output (I/O,) and other subsystems that must run on the embedded target, must, at a top level be contained in a single compound block.

In the fixed-point version of the fan-paddle position control system, the PID Controller (FIXED POINT CONTROLLER) and Volts to Degrees (FIXED POINT) are the control and logic functions for this system. To ready this system for direct implementation on an embedded target, it follows that all you need to do is collapse these two compound blocks into a single compound block.

To prepare for encapsulation, begin by duplicating the 0o and 90o calibration value constant, so that Fan-Paddle-Sensor and Volts to Degrees Converter each has its own set of constants.

Next, encapsulate PID Controller and Volts to Degrees in a single compound block named Embedded PID Controller.

A new local variable called paddle_pos_degrees is created and wired to an additional output tab to bring this value out and provide external access to it for monitoring purposes. The complete system representation is as follows:

In this form, Embedded PID Controller can generate, compile, link, and download embeddable C code to supported targets and perform hardware-in-the-loop system prototyping and validation.

When performing hardware-in-the-loop validation, the use of analog and digital inputs and outputs is quite common. Embed provides analog and digital I/Os that can be configured just as any other Signal Producer or Consumer block and placed inside the Embedded PID Controller block. Embed supports automatic programming of on-board analog and digital I/O, as well as all the important peripherals. The parameters entered in the configuration of the I/O points and peripherals, such as channel number, and range, are extracted and placed in the embedded control code for the Embedded PID Controller block and automatically downloaded to the target.