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.

Review

From http://www.kerhuel.eu/wiki - Simulink device driver Blockset for dsPIC / PIC24 / PIC32 Microcontrollers --[[User:LubinKerhuel|LubinKerhuel]] 12:40, 3 September 2009 (UTC)
Revision as of 07:51, 8 July 2009 by LubinKerhuel (talk | contribs)
Jump to navigation Jump to search

Rapid Prototyping Tools or experimentation for Microchip PIC / dsPIC microcontroller

Tools

Microchip

Microchip released a first version of a blockst in late 2008 (about november). The version 2 of the microchip blockset were released on June, 5th 2009. This second version seems more interresting as seems more similar to the blockst I developped (*). Anyway, interrupt seems not to be handeled properly to makes the peripheral works efficiently. A free evaluation version is available from their website. Please report your feeling on the forum.

(*) Strange facts: In microchip dsPIC_mrmain.tlc file in directory dspicblks, you can find

   %if (CalculusTimeStepEN == 1)
          CalculusTimeStep = TMR1;
   %endif
   %if (MasterBusyPort != -1)

The same instructions can be found in the original: In Lubin's blockset, dsPIC_mrmain.tlc file in directory blocks

   %if (CalculusTimeStepEN == 1)
       if (_T1IF) CalculusTimeStep = PR1;  /* Overload */
       else CalculusTimeStep = TMR1;     
   %endif
   %if (MasterBusyPort != -1)
   (differences comes from the fact that I improved it, i.e. Microchip did not get inspired from my last version)

This code is a very specific function that can only be found in the "Lubin's blockset". This code remains in their tool, even in V2 published on 5th 2009 despite this file is not used anymore. There are probably other example, but nevermind, I do not understand what's happening there. (I now scramble tlc files, thus, you will find variables name : CalculusTimeStepEN and CalculusTimeStep)

I strongly encourage Microchip to find many new ideas to make dsPIC programming easier and even more exciting with Simulink. But I would be disapointed if Microchip blockest is only a not finished copy, of tools already existing.

A workaround to remove the 30s pause : create a new m file called pause.m in the same directory as the model being compiled with the following text :

function pause(a)
 end


Quantiphi

product from SimuQuest companie sell a Matlab toolbox for Microchip PIC18Fx480/x580 (9000$ for a single licence including the UniPhi product)




Scicos-Scilab

Evidence Companie built a Scilab/Scicos Code Generator for the FLEX board which is based on a microchip microcontroller



Embedded Target for dsPIC

(Matlab Blockset from this website)

Supported chip :



See Release Notes and known bug for details

PIC 24F ' PIC 32F** ' PIC 30F ' PIC 30F ' PIC 33FJ GP ' PIC 33FJ MC ' PIC 33FJ GP ' PIC 33FJ MC*
24fJ128GA006 32MX360F256L 30f2010 30f5011 33fJ128GP206 33fJ256MC510 33fj128GP202 33fj128MC202
24fJ128GA008 32MX360F512L 30f2011 30f5013 33fJ128GP306 33fJ256MC710 33fj128GP204 33fj128MC204
24fJ128GA010 32MX460F256L 30f2012 30f5015 33fJ128GP310 33fJ64MC506 33fj128GP802 33fj128MC802
24fJ64GA006 32MX460F512L 30f3010 30f5016 33fJ128GP706 33fJ64MC508 33fj128GP804 33fj128MC804
24fJ64GA008 32MX775F256L 30f3011 30f6010 33fJ128GP708 33fJ64MC510 33fj32GP302 33fj32MC302
24fJ64GA010 32MX775F256L 30f3012 30f6011 33fJ128GP710 33fJ64MC706 33fj32GP304 33fj32MC304
24fJ96GA006 32MX795F512L 30f3013 30f6012 33fJ256GP506 33fJ64MC710 33fj64GP202 33fj64MC202
24fJ96GA008 32MX320 30f3014 30f6013 33fJ256GP510 33fJ128MC506 33fj64GP204 33fj64MC204
24fJ96GA010 32MX340 30f4011 30f6014 33fJ256GP710 33fJ128MC510 33fj64GP802 33fj64MC802
24fJ16GA002 30f4012 30f6015 33fJ64GP206 33fJ128MC706 33fj64GP804 33fj64MC804
24fJ32GA002 30f4013 33fJ64GP306 33fJ128MC708
24fJ48GA002 33fJ64GP310 33fJ128MC710
24fJ64GA002 33fJ64GP706
24fJ16GA004 33fJ64GP708
24fJ32GA002 33fJ64GP710
24fJ48GA002
24fJ64GA002
Newly added chip 
64MC204, 128MC204, 128GP202, 32MC202, 32MC204, 16MC304 , 33FJ256GP710A
* PIC 32F
SPI function not suported yet;
* Compiler known and fixed bugs 
* Check your compiler installation and version 
at the matlab prompt ==> !pic30-gcc -v for pic30 and !pic32-gcc -v for pic32.
**Check pic32 compiler v 1.04 Workaround
**Check pic30 compiler PWM 2 Workaround from version v 3.12 to current version (3.25)...




Experimentation

The Autonomous Unmanned Systems (USL)

This team at the University or South Florida works of Unmanned Aerial Vehicles (UAV). In a step by stem approach, they validate the simulink generated code by compiling it and connecting the "Autopilote PC-software" to a plane simulation software (X-Plane). Then, they compile the code to implement it into a PIC18f 4620. They deal with timing and PIC peripheral by integrating "hand coding functions" into the code generated by Matlab.

Two refferences: ( PDF available on http://splatsosoft.com:81/site/jeff/vitae.html )

D. Ernst, K. Valavanis, J. Craighead, “Unmanned Vehicle Controller Design, Evaluation and Implementation: From MATLAB to Printed Circuit Board”, Journal of Intelligent and Robotic Systems (In print)

D. Ernst, K. Valavanis, J. Craighead, Automated Process for Unmanned Systems Controller Implementation Using MATLAB, CD-ROM Proceedings, 14th Mediterranean Conference on Control and Automation, Ancona, Italy, June 2006.