Blockset described on this wiki is deprecated since 2012.
For Model Based Design (MBD), use the free MPLAB Device Blocks for Simulink, tool from Microchip.
Updated Rapid Control Prototyping (RCP) custom projects are published at: https://lubin.kerhuel.eu.
Difference between revisions of "Simulink - Embedded Target for PIC"
LubinKerhuel (talk | contribs) (New page: =Simulink Blockset Embedded Target microchip devices : Pic24 / Pic 30 / Pic 32 /Pic33= Embedded Target for PIC / dsPIC is a '''blockset''' for '''Matlab'''® that works on the top of the ...) |
|||
Line 1: | Line 1: | ||
=Simulink Blockset Embedded Target microchip devices : Pic24 / Pic 30 / Pic 32 /Pic33= | =Simulink Blockset Embedded Target microchip devices : Pic24 / Pic 30 / Pic 32 /Pic33= | ||
+ | [[Image:BlocksetLibraryBrowser.png|tumb|400px|frame|right|List of all [[Block| Blocks]] composing the PIC/dsPIC blockset for Simulink]] | ||
Embedded Target for PIC / dsPIC is a '''blockset''' for '''Matlab'''® that works on the top of the MathWorks '''Simulink'''®. | Embedded Target for PIC / dsPIC is a '''blockset''' for '''Matlab'''® that works on the top of the MathWorks '''Simulink'''®. | ||
− | |||
− | + | ==Presentation== | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | The blockset '''Generates C code wit one click from a simulink model''' for a wide list of Microchip microcontroller. The geenrated C code is compiled on the fly to get the binary file ( .hex and .cof file) '''ready to be downloaded into the targeted microcontroller'''. The downloaded program behave similarly to the simulink model. | ||
− | + | This '''fast prototyping tool''' for 16 bits PIC MCU : | |
− | |||
− | |||
* generates and compiles C code from a simulink model and/or a Stateflow flow chart | * generates and compiles C code from a simulink model and/or a Stateflow flow chart | ||
Line 25: | Line 19: | ||
* compile the C files generated with the gcc compiler provided by Microchip | * compile the C files generated with the gcc compiler provided by Microchip | ||
− | The blockset allow to lets you concentrating on the | + | The blockset allow to lets you concentrating on the mathematical part (control, filter ..) and on the the logic of the simulink model. You can simulate the model that will be implemented into the microcontroller. You '''do not need to know much about PIC/dsPIC programming'''. The blockset support most peripheral present on the microcontroller and '''configure automatically the peripheral''' selected (configure also timers and model time step). |
− | + | ==Debugging and monitoring on chip program with Matlab== | |
− | |||
'''Debugging and monitoring''' variables is very easy through UART thanks to one simulink block and its Graphical User Interface associated : | '''Debugging and monitoring''' variables is very easy through UART thanks to one simulink block and its Graphical User Interface associated : | ||
Line 43: | Line 36: | ||
+ | ==Capabilities== | ||
+ | The blocks added to the simulink® library allow to connect most of the PIC24, dsPIC30 and dsPIC33 peripherals (PWM, ADC, IC, OC, SPI, I2C, CAN, UART ...) to any other Simulink blocks | ||
+ | C code generated for theses peripheral is merged to the C code generated by the Real Time Embedded Coder® toolbox. | ||
Possible target are most of the dsPIC30f, dsPIC33, PIC24H and few PIC32. ( see detail on the download page) | Possible target are most of the dsPIC30f, dsPIC33, PIC24H and few PIC32. ( see detail on the download page) | ||
Line 53: | Line 49: | ||
See examples for more details on the capabilities of the blockset. | See examples for more details on the capabilities of the blockset. | ||
+ | |||
+ | |||
+ | *Here is a '''[[Review]]''' of similar tools for PIC or dsPIC. | ||
Consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software. | Consult the [http://meta.wikimedia.org/wiki/Help:Contents User's Guide] for information on using the wiki software. |
Revision as of 14:08, 15 June 2008
Contents
Simulink Blockset Embedded Target microchip devices : Pic24 / Pic 30 / Pic 32 /Pic33

Embedded Target for PIC / dsPIC is a blockset for Matlab® that works on the top of the MathWorks Simulink®.
Presentation
The blockset Generates C code wit one click from a simulink model for a wide list of Microchip microcontroller. The geenrated C code is compiled on the fly to get the binary file ( .hex and .cof file) ready to be downloaded into the targeted microcontroller. The downloaded program behave similarly to the simulink model.
This fast prototyping tool for 16 bits PIC MCU :
- generates and compiles C code from a simulink model and/or a Stateflow flow chart
- makes the development faster, bugfree and easily updated
- makes the implementation of complex calculation easy
- allows to optimize the fix point calculation using the matlab fixed point tools
- allows to monitor and to log data in pseudo real time with matlab
- allows to import your specific written C functions into the simulink model and in the microcontroller
- compile the C files generated with the gcc compiler provided by Microchip
The blockset allow to lets you concentrating on the mathematical part (control, filter ..) and on the the logic of the simulink model. You can simulate the model that will be implemented into the microcontroller. You do not need to know much about PIC/dsPIC programming. The blockset support most peripheral present on the microcontroller and configure automatically the peripheral selected (configure also timers and model time step).
Debugging and monitoring on chip program with Matlab
Debugging and monitoring variables is very easy through UART thanks to one simulink block and its Graphical User Interface associated :
- The block "Interface Tx-matlab" implement a high level protocol using one UART port of the microcontroller. This block allows to send data from the microcontroller to the PC host in real time.
- A matlab graphical user interface can receive theses data through the Serial port of the PC/mac (can be a USB emulated serial port) and plot them in real time.
It makes real time Monitoring and debugging easy.
It also allows to log data into the matlab workspace. The logged data can be used to feed a simulink model for simulation. Thus, real microcontroller input data recorded (from ADC, IC...) are used for the simulink simulation or .m script file allowing to test or improve the simulink model using real data logged in real condition. Once you have tune the math part of your model, you can then reprogramme the microcontroller with the new improved model. The simulation result will be very close to the real model running in the microcontroller since input data comes from the same peripheral and the microcontroller's running model is equivalent to the PC simulation model.
Capabilities
The blocks added to the simulink® library allow to connect most of the PIC24, dsPIC30 and dsPIC33 peripherals (PWM, ADC, IC, OC, SPI, I2C, CAN, UART ...) to any other Simulink blocks C code generated for theses peripheral is merged to the C code generated by the Real Time Embedded Coder® toolbox.
Possible target are most of the dsPIC30f, dsPIC33, PIC24H and few PIC32. ( see detail on the download page) Supported Chip :
See Release Notes and known bug for details
|
The blockset for simulink works with the GCC compiler from Microchip®. MPLAB is not required but can be used for the programming the microcontroller (import the .hex file and programme the target).
Many Mathworks toolbox like "Stateflow®" and "Stateflow coder®" or "fixed point blockset" can be used with the blockset "Embedded Target for dsPIC".
See examples for more details on the capabilities of the blockset.
- Here is a Review of similar tools for PIC or dsPIC.
Consult the User's Guide for information on using the wiki software.