A MATLAB toolbox for real-time control using Infineon C167 microcontrollers





MIRCOS 167 is a MATLAB toolbox for real-time control on Infineon C167 microcontrollers. Using MathWork’s Real-Time Workshop a Simulink block diagram can be built directly into a C167 target application. A number of serial communication blocks allow the formation of a simple interface for real-time exchange of data between a host (PC) and the target (microcontroller, MC). These blocks can be used to monitor process data as well as for on-line tuning of parameters.


As an adaptation of the C166 based toolbox ‘MIRCOS’ by Sven Rebeschieß (Technical University Berlin), the present version retains most of the original features while bringing it in line with the latest release of MATLAB (V6.1, R12.1) and a more recent type of controller (C167). The transition from MIRCOS (V0.9) to MIRCOS 167 has lead to a number of modifications in both the real-time kernel and the block specific s-functions. Unlike its predecessor, MIRCOS 167 does not rely on any compiler specific features. The relatively cost intensive KEIL compiler suite (C166) has been replaced by the more moderately priced Hightec compiler ‘GCC166’. As an additional bonus, an evaluation version of this compiler can be downloaded free of charge from the Hightec web page. Smaller models with a total code size of up to 64 kByte can be compiled with this evaluation version. Unfortunately, the automatically generated code of tends to result in fairly large executables. However, the allowance of a code size of 64 kByte permitted by the Hightec compiler (evaluation version) is often sufficient for simple laboratory exercises and student projects. This version of the toolbox is therefore aimed at educational institutions such as schools and small universities whose tight budgets often prohibit the purchase of ‘more professional’ equipment. However, as a number of institutions might have access to the full version of the KEIL compiler, a suitably modified version is also available.


MIRCOS 167 has been developed and tested on the Phytec single-board computer phyCORE-167 and the corresponding rapid prototyping board (phyCORE-HD200). However, it should be relatively straightforward to use this toolbox on most other C167 based target boards. A number of details regarding the hardware set-up can be found in appendix A of the MIRCOS 167 User Manual (Word 2000, <MIRCOS_ROOT>\docs\Mircos167.doc).


MIRCOS 167 is distributed as ‘Free Software’ under the terms of the GNU Public License Agreement. Potential users are hereby given the right to copy, re-distribute and modify this program to suit their needs. Any commercial use, however, is excluded by the original license agreement which states that


“MIRCOS for MATLAB/Simulink Version 0.9 is semi-free software. You can redistribute it and/or modify it under the terms of the GNU General Public License Version 2 as published by the Free Software Foundation (see file COPYING.TXT included) for non-profit purposes (educational, scientific and personal purposes). You may not use it for commercial purposes. You may not sell it, and you may not sell or commercially exploit the results you obtained by using it.”



Your feedback is always welcome. Please send your comments to:



Frank Wornle ()

The University of Adelaide

School of Mechanical Engineering


December, 2003





(1)     The KEIL distribution is an adaptation of the earlier Hightec version. The superior capabilities of the KEIL compiler prompt for a multitude of optimisations. At present, however, neither the special function register addressing modes 'sbit' and 'sfr' nor the built-in access to the internal RAM of the micro-controller through the data type 'idata' have been exploited to optimise the original source code.


(2)     A number of modules are currently excluded from the build process of the MATLAB real-time library. This became necessary to keep the KEIL Library Manager happy (LIB166 reported ‘re-definitions of symbol names’). For details, see $(MIRCOS_ROOT)/rtc167/omit/readme.txt.






To download a copy of MIRCOS-167 for the Hightec compiler suite (works with the freely available evaluation version) click here.


To download a copy of MIRCOS-167 for the KEIL compiler suite (full version required) click here.