<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.10/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.10/ http://www.mediawiki.org/xml/export-0.10.xsd" version="0.10" xml:lang="en">
  <siteinfo>
    <sitename>Lubin KERHUEL website</sitename>
    <dbname>kerhuelforum</dbname>
    <base>https://www.kerhuel.eu/wiki/Simulink_-_Embedded_Target_for_PIC</base>
    <generator>MediaWiki 1.33.0</generator>
    <case>first-letter</case>
    <namespaces>
      <namespace key="-2" case="first-letter">Media</namespace>
      <namespace key="-1" case="first-letter">Special</namespace>
      <namespace key="0" case="first-letter" />
      <namespace key="1" case="first-letter">Talk</namespace>
      <namespace key="2" case="first-letter">User</namespace>
      <namespace key="3" case="first-letter">User talk</namespace>
      <namespace key="4" case="first-letter">Wiki</namespace>
      <namespace key="5" case="first-letter">Wiki talk</namespace>
      <namespace key="6" case="first-letter">File</namespace>
      <namespace key="7" case="first-letter">File talk</namespace>
      <namespace key="8" case="first-letter">MediaWiki</namespace>
      <namespace key="9" case="first-letter">MediaWiki talk</namespace>
      <namespace key="10" case="first-letter">Template</namespace>
      <namespace key="11" case="first-letter">Template talk</namespace>
      <namespace key="12" case="first-letter">Help</namespace>
      <namespace key="13" case="first-letter">Help talk</namespace>
      <namespace key="14" case="first-letter">Category</namespace>
      <namespace key="15" case="first-letter">Category talk</namespace>
      <namespace key="2300" case="first-letter">Gadget</namespace>
      <namespace key="2301" case="first-letter">Gadget talk</namespace>
      <namespace key="2302" case="case-sensitive">Gadget definition</namespace>
      <namespace key="2303" case="case-sensitive">Gadget definition talk</namespace>
    </namespaces>
  </siteinfo>
  <page>
    <title>Simulink - Embedded Target for PIC</title>
    <ns>0</ns>
    <id>126</id>
    <revision>
      <id>1550</id>
      <parentid>1549</parentid>
      <timestamp>2019-03-20T13:10:29Z</timestamp>
      <contributor>
        <username>LubinKerhuel</username>
        <id>1</id>
      </contributor>
      <minor/>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text xml:space="preserve" bytes="5752">= Simulink Blockset Embedded Target microchip devices: Pic24 / Pic 30 / Pic 32 /Pic33  =

[[Image:BlocksetLibraryBrowser.png|frame|right|300px|&lt;big&gt;Link to [[Block|blocks details]] .&lt;/big&gt; ]] 

&lt;big&gt;Embedded Target for PIC / dsPIC is a '''blockset''' for '''Matlab'''® that adds to simulink® [[Block|Blocks  specific to dsPIC and PIC32 peripheral]].&lt;/big&gt;

&lt;br&gt; Watch the Screencast (April 2009). Better quality movie is available [http://vimeo.com/download/video:7952623?v=2&amp;e=1252406968&amp;h=55bf82df2c3ed83c62a513ce4390ecd3&amp;uh=1d135a0ad665aba5aed40825be946851 here] 
{{#evt:
service=vimeo
|id=6481193
|alignment=center
|container=frame
|dimensions=800
|autoresize=true
|description=realized by [http://users.soe.ucsc.edu/~malife/ Mariano Lizarraga] for the [http://slugsuav.soe.ucsc.edu/crew/crew.html SLUG] team
}}

&lt;br&gt; 

== Presentation  ==

The blockset '''generates C code from a Simulink model''' for a wide list of '''Microchip microcontrollers'''. The generated C code is compiled on the fly to obtain the executable binary file (.hex and .coff file) '''ready to download into the targeted microcontroller'''. The downloaded binary program behaves like the Simulink model. 

This '''rapid prototyping tool''' for 16 bits PIC MCU allows to&amp;nbsp;: 

*generate and compile C code from a Simulink model and/or a Stateflow flow chart 
*make the development '''easier''', '''faster''', '''bug free''' 
*make the software easy to update 
*Benefit from the Simulink graphical environment to describe complex calculation and complex models 
*'''optimize fixed point calculation''' using the user friendly matlab fixed point toolbox 
*'''monitor, log and plot data''' sent by the microcontroller with a matlab graphical user interface 
*Use the logged data (from sensors) to optimize the embedded software using the Simulink simulation capabilities 
*'''import your specific written C functions''' into the Simulink model and in the microcontroller
*Open C files as a "ready to use" project within MPLAB 8 or MPLAB X IDE.

When programming a microcontroller, a lot of time is usually spent on peripheral configuration and on real time problems like sampling rate, multitasking... This blockset gives you the possibility to get ride of these tasks and to concentrate only on the math part (control, filter, logic ...) of the Simulink model. You can simulate the model that will be implemented into the microcontroller. You '''do not need much knowledge about PIC/dsPIC programming'''. The blockset support most peripheral present on the microcontroller and '''configure automatically selected peripherals''' (configure also timers and model time step). 

&lt;br&gt; 

== Debugging and monitoring on chip program with Matlab  ==

'''Debugging and monitoring''' variables is very easy through UART thanks to one simulink block and the Graphical User Interface associated: 

[[Image:DevelopmentCycleWithBlockset.png|thumb|right|450px]] 

*The block "Interface Tx-matlab" implements 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''' very easy. 

It also allows logging 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 (noise and characteristics are the real one). Once the simulated model is tune, you can just re-program 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 come 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, dsPIC33, and PIC32 peripherals (PWM, ADC, IC, OC, SPI, I2C, CAN, UART ...) to any other Simulink blocks. 

C code generated for these peripheral is merged with the C code generated by the Real Time Workshop Embedded Coder® toolbox. 

Possible target is most of the dsPIC30f, dsPIC33, PIC24H and few PIC32. ( see details on the download page) 

Supported Chip:

{{PicList}} 

The blockset for simulink works with the GCC compiler from Microchip®. MPLAB is not required but can be used for the programming the microcontroller (imports the .hex file and program 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 blockset capabilities. 

&lt;br&gt;

= Others Blockset for dsPIC  =

*Here is a '''[[Review]]''' of similar tools for PIC or dsPIC.

= Feedback  =

To provide feedback or add comment about curent page content, please click on "leave a message" at the bottom of most pages. You message will appears at the bottom of the page. Use [http://www.kerhuel.eu/forum forum] for more general questions or if you need to upload a file (simulink model, image, or whatever). 

= Need help to make a better site  =

You are encouraged to crawl through pages and to grab as much information as you need. If you encounter incorrect information, please '''take time for update this website'''. Anyone can edit the wiki. You just need to [[Special:Userlogin|Log in]] and an edit panel button will appears at the very top of the webpage.</text>
      <sha1>5ux8d7hqnz1qz0zb85pe32zq4nnq8d0</sha1>
    </revision>
  </page>
</mediawiki>
