How to write Matlab Code for Microcontroller (such as 8051, PIC) and convert them into HEX code such that it can be burn on the microcontroller ?

I am a newbie i m doing project on microcontroller so i want to write the codes for microcontroller on MATLAB and use it on the microcontroller. Please help me....

回答 (2 件)

Kaustubha Govind
Kaustubha Govind 2012 年 8 月 15 日
You can use the MATLAB Coder product to generate standalone C code from your MATLAB code, and then use the tool-chain specific to your hardware to convert the C code to binary code. Note that not all MATLAB functions are supported for code-generation. Please see MATLAB Language Subset for Code Generation.

10 件のコメント

Thanks ... Does Matlab R2010a comes with Matlab Coder?? Can u provide me a simple Matlab Code for 8051 microcontroller to have an idea ?
MATLAB Coder is an optional (and expensive) product. Also I think R2011a might have been the first version that supported it.
@Pankaj: Walter has answered your first question. MATLAB Coder does not generate code specific to 8051, it is generic ANSI-compliant code.
ok apart from this... i m doing a project based on 8051 microcontroller. Which programming language will be better to program this microcontroller MATLAB language or Embedded C? Please suggest me...
TAB
TAB 2012 年 8 月 17 日
編集済み: TAB 2012 年 8 月 17 日
As described above, Matlab language can not be directly used to program the micro-controller. If you have developed your requirement in Matlab, then it need to be converted into C-language and generated code need to be integrated with other low level (could be hand written) code. Low level code (like interrupt handling, Peripheral configuration) are not generated by matlab.
Matlab/Simulink is always used to program for complex system which are to executed on higher end micro-controllers with no memory & speed constraints. Also the generated code is not much optimized as handwritten code.
So, for the lower end controllers like 8051 (where memory and execution speed is always a concern), and for simple applications, it is recommended to use handwritten code in C.
Thanks TAB...i got it
papan dey
papan dey 2013 年 4 月 23 日
is it possible to write code in PIC for abc-dqo transform?can anyone help me?thank you.
esra
esra 2013 年 9 月 11 日
pleas no version of matlab can change code from matlab to c ?
esra
esra 2013 年 9 月 11 日
for install in PIC
MATLAB Coder, an optional product, can convert some subsets of MATLAB to ANSI C code. There is no version of MATLAB that can convert MATLAB to C without using MATLAB Coder (or, on very early releases, MATLAB Compiler, but these days that is not what the modern MATLAB Compiler does.)

サインインしてコメントする。

Sachin Verma
Sachin Verma 2016 年 10 月 6 日
Hii , i convert code to c from matlab simulink model. How to specify pin fuction in sumulink model of matlab generated code to do task. like adc input pin or output pin.

製品

質問済み:

2012 年 8 月 15 日

コメント済み:

2016 年 10 月 6 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by