Introduction to Microchip-SIMULINK Blocksets and MATLAB Plug-in for MPLAB IDE

Similar documents
MPLAB SIM. MPLAB IDE Software Simulation Engine Microchip Technology Incorporated MPLAB SIM Software Simulation Engine

A Quick Introduction to MPLAB SIM

MPLAB X IDE PROJECTS Microchip Technology Incorporated. All Rights Reserved DEV Slide 68

MATLAB /Simulink Device Blocksets for dspic DSCs

Prefetch Cache Module

MATLAB /Simulink Device Blocksets for dspic DSCs

Debug Tool Fashion Accessories An showcase of development tool accessories designed to enhance your debug session

Development of Simulink blockset for embedded system with complex peripherals

Welcome to Installing and using HI-TECH C PRO for the PIC10/12/16 MCU Family with the MPLAB IDE.

Microchip WebSeminar

Section 1. Introduction

Experiment 8 SIMULINK

Manual of Board ET-PIC STAMP 18F8722-K22 ET-PIC STAMP 18F8722-K22

MPLAB C18 C Compiler

Note that FLIP is an Atmel program supplied by Crossware with Atmel s permission.

Release Notes for MPLAB Code Configurator s MikroElektronika Click Library v1.0.25

Lower Limb Exoskeleton. Tina Nguyen University of California, Santa Cruz Bionics Lab Advisor: Jacob Rosen Graduate Student: Jared Mednick

Lab 6 : Introduction to Simulink, Link for CCS & Real-Time Workshop

Dspic33f Pic24h Family Reference Manual Section 11

How to program the Fast Amplifiers

Programming in the MAXQ environment

Experiment 3. Getting Start with Simulink

ADSP-BF707 EZ-Board Support Package v1.0.1 Release Notes

Debugging in AVR32 Studio

Tutorial - Exporting Models to Simulink

Microchip Launches Free, Cloud-based Development Platform for PIC MCUs. MPLABXpress.microchip.com

Introduction to ARDUINO/SIMULINK

Lab 1 Introduction to Microcontroller

As CCS starts up, a splash screen similar to one shown below will appear.

SIGNALS AND LINEAR SYSTEMS LABORATORY EELE

You have a PC with a USB interface, running Microsoft Windows XP (SP2 or greater) or Vista You have the Workshop Installation Software Flash Drive

IBM i Debugger. Overview Service Entry Points Debugger Functions Attach to an IBM i Job Launch Configurations and Settings

Release Notes for MPLAB Code Configurator v2.25.1

ECE 487 LAB 1 ÇANKAYA UNIVERSITY Overview of DSP Board

Release Notes for MPLAB Code Configurator v2.10

Importing Models from Physical Modeling. Tools Using the FMI Standard

Tools Basics. Getting Started with Renesas Development Tools R8C/3LX Family

Lab 0 Introduction to the MSP430F5529 Launchpad-based Lab Board and Code Composer Studio

FMI Kit for Simulink version by Dassault Systèmes

e-snaps Online Training Navigation Tutorial

Tutorial 2 - Welcome Application Introducing, the Visual Studio.NET IDE

Quick Start Guide TWR-S08PT60. 5-Volt S08P Family of 8-bit MCUs for Industrial and Appliance Applications TOWER SYSTEM

User Manual. LPC-StickView V3.0. for LPC-Stick (LPC2468) LPC2478-Stick LPC3250-Stick. Contents

C Programming in Atmel Studio 7 Step by Step Tutorial

User Manual. LPC-StickView V1.1. for LPC-Stick. Contents

APPENDIX A. CODE COMPOSER STUDIO (CCS) v5: A BRIEF TUTORIAL FOR THE DSK6713

Introduction. Prerequisites: Procedure Steps. Step1: Downloading and Adding the MCC Plugin

AVR MICROCONTROLLER PROJECT TUTORIAL E-PUB

SKP16C26 Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

INSTRUCTIONS FOR SETTING UP ROACH SOFTWARE IN MPLAB-X

Model-Based Design Toolbox

Release Notes for ADSP-SC5xx EZ-KIT Lite Board Support Package 2.0.1

NSIGHT ECLIPSE EDITION

University of Hawaii EE 361L MPLab Quick Tutorial and Project 2.1 Last updated September 1, 2011

ADSP-BF707 EZ-Board Support Package v1.0.0 Release Notes

8438/8838 User Manual User Manual of the 8438/8838 MATLAB Embedded Controllers

M16C/62P QSK QSK62P Plus Tutorial 1. Software Development Process using HEW4

Exercise: PWM Generation using the N2HET

Quick-Start Guide. BNS Solutions. QSK62P Plus

xpc Target Tutorial Control System Design Feb. 15, 2004 For more detailed information, see the xpc target manual at:

CHIPS Newsletter Vol 5 - Yahoo! Mail. Official Newsletter of

Chapter 7. Hardware Implementation Tools

Cypress MicroSystems Application Note 1017

Getting Started with STK200 Dragon

As CCS starts up, a splash screen similar to one shown below will appear.

DOMAIN TECHNOLOGIES. Getting Started Guide Version 1.1. BoxView IDE. Integrated Development Environment

NSIGHT ECLIPSE EDITION

WS_CCESBF7-OUT-v1.00.doc Page 1 of 8

NEW CEIBO DEBUGGER. Menus and Commands

Computer Aided Design (CAD) Lecture 10. Introduction to Simulink (3) Dr.Eng. Basem ElHalawany

Session 3 Introduction to SIMULINK

ECE-320 Lab 3: Utilizing a dspic30f6015 to model a DC motor and a wheel

MyEricsson Administration Manual

Navigating Board Docs

SIMULATION OF MCU HARDWARE PERIPHERALS

Administrator Quick Guide

None. MICROCONTROLLERS III

NIOS CPU Based Embedded Computer System on Programmable Chip

MT2 Introduction Embedded Systems. MT2.1 Mechatronic systems

16-bit Embedded Control Solutions

Optional Eclipse Workspace Configurations

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

ERIKA Enterprise Tutorial

II. RTW BUILD METHODS In order to understand how RTW generates C code and produces an executable image, the build process can be divided into three st

CPE 323: Laboratory Assignment #1 Getting Started with the MSP430 IAR Embedded Workbench

LOAN IQ DIAGNOSTIC TOOLS Topic of the Month FusionBanking Loan IQ

Figure 1. Simplicity Studio

APPLICATION COMMON OPERATING ENVIRONMENT (APPCOE)

PSIM SIMULATION SOFTWARE. TUTORIAL How to use the Simcoupler

WEBppliance for Windows User Administrator's Help

Salvo Compiler Reference Manual Microchip MPLAB C30

Supporting Custom Boards with DSP Builder

Drools Tools Reference Guide. Version: CR1

ADS MultiTrace Tutorial v2.0

16-bit Embedded Control Solutions

_ V Intel 8085 Family In-Circuit Emulation. Contents. Technical Notes

System Framework Overview Guide and Instructions on How to Use the Template Projects

Parag Choudhary Engineering Architect

Rotary Motion Servo Plant: SRV02. Rotary Experiment #00: QuaRC Integration. Using SRV02 with QuaRC. Student Manual

CST8152 Compilers Creating a C Language Console Project with Microsoft Visual Studio.Net 2010

Transcription:

Introduction to Microchip-SIMULINK Blocksets and MATLAB Plug-in for MPLAB IDE Produced by Murali Manohara Chembarpu 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 1 Welcome to Introduction to Microchip-SIMULINK Blocksets and MATLAB Plugin for MPLAB IDE 1

Introduction & Agenda Introduction to Microchip Device Blocksets Introduction to MATLAB Plug-In in MPLAB IDE Creating a SIMULINK model with Microchip Blockset and building them Learning Goal: To create a SIMULINK model using Microchip Blockset, generate C code from it and build it 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 2 MATLAB is a very widely used model based design tool. Microchip s MPLAB IDE has a Plug-In capable of importing source files generated by RTW component of MATLAB. Users can configure the peripherals of dspic DSC devices in MATLAB/SIMULINK environment using Microchip Device Blockset which can be located in SIMULINK library tree after installation. Application models can be created using Microchip Device Blockset and generic SIMULINK blocks. These models can be built either independently from MATLAB or using MATLAB Plug-in. The hex/cof files generated from MATLAB can be programmed using Microchip or third party programmers. When MATLAB Plug-in is used, code generated can be modified and debugged from MPLAB environment. This session will last about 15 minutes, we will go through the steps to use Microchip Device Blockset and MATLAB Plug-In. This will also guide you through SIMULINK Model creation, configuring RTW parameters, generate code, build and debug code generated from SIMULINK models. 2

Vocabulary MATLAB/SIMULINK SIMULINK Model RTW- Real Time Workshop RTW Embedded Coder 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 3 Let s look at some of the words we will encounter in this session. MATLAB/SIMULINK This is popularly used tool for mathematical computation and model based design. SIMULINK Model This is in general a pictorial representation of an application. Created using blocks provided by MATLAB as well as third parties. RTW- Real Time Workshop This is a optional product of MATLAB which can generate ANSI C code from SIMULINK models. RTW Embedded Coder This is an optional add-on to RTW. Code generated by RTW is generic in nature. Embedded coder generates optimized code suitable for embedded targets. 3

Introduction To SIMULINK- Microchip Blocksets Blocksets to configure and use all peripherals of dspic33 family devices Categorized under two types- dspic33f target blocks that allow configuration of devices code generated forms initialization part dspic33f General code generated forms the run-time loop 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 4 The SIMULINK-Microchip blocksets run with Real-Time Workshop and RTW Embedded Coder of MATLAB. These blocks enable you to do model-based design of your applications and offload you from the hassle of going through datasheets and configuring peripherals. The Auto-code generation feature of RTW Embedded Coder coupled with drivers behind the microchip blocksets generate efficient C code for your models. These blocksets appear under two main categories: dspic33f Target- These bocks allow you to configure various peripherals for initialization purposes. You can configure by double clicking on these blocks. These configurations would reflect in the initialization code that is generated from these models e.g., : UART Config dspic33f General- These bocks allow you to configure various peripherals for run-time purposes. You configure by double clicking on these blocks. These configurations would reflect in run-time code generated from these models. E.g.,: UART transmit 4

dspic33f Target Blocksets Facilitate the configuration of various peripherals of dspic33f family for initialization code 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 5 The picture here shows dspic33f Target library. You can pull these blocks into your models and configure them as per your requirements. Peripherals supported here include, but are not limited to: ADC, UART, SPI, Output Compare, CAN, Timers, DMA, I 2 C, DCI, motor Control PWM etc,. This library also has a block ccall to import user developed C routines into SIMULINK models. These routines would be compiled and built along with files generated from the model. dspic33fxx Main block found here is essential component for every application model that you create. This allows you to configure clocks, Oscillators etc. 5

dspic33f General Blocksets Facilitate the configuration of various peripherals of dspic33f family for runtime Code 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 6 The picture here shows dspic33f General library. You can pull these blocks into your models and configure them as per your requirements. Blocks found under this library generally have one or more input/output ports, which have to be connected to appropriate source/sink blocks. E.g.,: UART transmit block has an input port which accepts uint16/int16 data type and transmits it on every timer expire event. This timer has to be configured in dspic33f Main block. 6

Steps to Use MATLAB Plug-In 1. Start Plug-In Tools>Matlab/Simulink 2. Open Simulink Model Matlab/Simulink>Specify Simulink Model Name 3. Open up a Project Project->New or Project->Open 4. Generate Code and Import files Matlab/Simulink>Generate Code and Import Files 5. Build, program, debug 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 7 Here is an overview of the steps to use MATLAB Plug-In for MPLAB. 1. Select Tools>Matlab/Simulink from the menu. 2. Select Matlab/Simulink>Specify Simulink Model Name to specify the SIMULINK model to be opened for code generation. 3. Open up a Project, either fresh one or an existing one. The code generated will be added to this project. 4. Click on Generate Code. The plug-in will generate code through RTW embedded coder. 5. Click on Import Generated files. The plug-in will include all generated files into the active project. 6. You can edit (if required) and build the code generated. You can program the hex/cof through MPLAB IDE. You can also do source-level debugging in the same way you would do with hand written code. 7

MATLAB Plug-In 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 8 The screen shot shows the MPLAB IDE with MATLAB/SIMULINK menu. It appears when user clicks on MATLAB/SIMULINK in Tools drop down menu of MPLAB IDE. When you click on Specify Simulink Model name, it will prompt the user to choose a SIMULINK model to open. If it is the first time you are working with MATLAB, you need to launch MATLAB and create and save a SIMULINK model separately so that you can specify that model name in the plug-in. Once you choose a SIMULINK model, MPLAB will launch MATLAB and open up the SIMULINK model that you specified. This model can be modified and saved. It is mandatory to have a project in MPLAB IDE before you generate code from a model. 8

1. Launch MATLAB 2. Click on SIMULINK button Launch SIMULINK 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 9 1. Launch MATLAB 2. Click on SIMULINK icon as shown in the picture. This would open up SIMULINK library browser. This will have default SIMULINK blocks and different blocksets that you might have bought from Mathworks. 3. Make sure that Embedded Target for Microchip dspic appears in SIMULINK library tree. If it does not exist, then you need to install it or add path of installation to MATLAB paths. Refer to Device Blocks Deployment details.doc 9

Create a new SIMULINK model-1 Click on Create a new Model in SIMULINK Library browser 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 10 1. Click on Create a new Model in SIMULINK Library browser. This would open up an empty model file. You can populate this model file with different blocks from SIMULINK library and create an application model. 10

Create a new SIMULINK model-2 Populate your model file with required blocks 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 11 Populate your model file with required blocks. You can use Generic SIMULINK blocks which support fixed point data types along with microchip blocks. Generic SIMULINK blocks can be checked for compatibility by clicking on Signal Attributes tab in their respective masks (the pop-up GUI that appears when you double click on these blocks). If data types like uint16, int8 etc are listed there, these blocks can be used with microchip blocksets. 11

Microchip blocksets in SIMULINK Library browser Use these blocks with any fixed point generic blocks of SIMULINK to create application models 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 12 This diagram shows Embedded Target for Microchip dspic contents in SIMULINK library browser. These blocks can be pulled to the model that you are creating. Double clicking on these blocks (after placing them in models) allows you to configure these blocks. You can use all generic SIMULINK blocks which support fixed point operations. Blocks which have input/output ports need to be connected with appropriate sources/sinks. For e.g.,: for UART transmit, you need to connect a block which outputs a uint16/int16 datatype. 12

RTW Settings Real Time Workshop Options 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 13 This picture shows how to launch Real Time workshop Configuration dialog. Once the SIMULINK block is designed and ready, you need to do some configuration settings for each model. These settings are used in configuring generated code from the respective models. 13

RTW configuration Select system target file 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 14 Here we have view of Real Time Workshop pane of RTW configuration dialog. You have to choose dspic_33fxx.tlc as system target file. You can choose this file by clicking Browse button which is circled in the picture shown. This will pop up a list of system target files that are registered in your MATLAB installation. If you would be using MATLAB plug-in and MPLAB IDE to build, ert.tlc also can be used as system target file Generate makefile option can be unchecked Generate code only Option can be checked If you would like to build this model without the help of plug-in in MPLAB IDE, You should check Generate Makefile Option Generate code only Option should be unchecked 14

RTW Solver Configuration Select fixed point solver 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 15 Here we have view of Solver pane of RTW configuration dialog. Since Microchip blocksets do not have simulation capabilities, you need to select fixed step type discrete (no continuous state) solver. All other fields can be left to default. 15

RTW Hardware Implementation Hardware properties 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 16 Here we have view of Hardware Implementation pane of RTW configuration dialog of MATLAB R2007a. Select custom device type (R2007b onwards, there will be an additional field, where you can choose generic ) Select number of bits as follows: Char- 8, short- 8, int-16, long- 32, native word size -16 Byte ordering- Little Endian Emulation Hardware- check none 16

Code Generation and Build Generate code and import files 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 17 Picture here shows how to generate and import files from a SIMULINK model once you have configured RTW settings and saved the model. It is mandatory to have a project in MPLAB IDE before you generate code from a model. Generate Code generates code from the model specified. Import Generated Files imports all the files that are generated from the model into the active project. All other dependent files are compiled and object files are archived and imported as matlab_core.a By clicking Generate Code and Import Files both operations of generating files and importing them into project in a single step. Add library files libp33fjxxxxxxx-coff.a and libp33fjxxxxxxxx-elf.a to the project and build. To trace arrays when the MPLAB REAL ICE in-circuit emulator or MPLAB SIM simulator is the debugger, select Array Snapshot. Tracing array variables occurs on a Halt. The data can be loaded in the MATLAB workspace. To use the data capture facility of the MPLAB REAL ICE in-circuit emulator, select Data Capture. The data can be loaded in the MATLAB workspace. 17

Building SIMULINK Models Directly Make Settings- dspic options 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 18 Here we have view of dspic Options pane of RTW configuration window. This will appear only if you have chosen dspic_33fxx.tlc as system target file. These settings will be effective only if you build SIMULINK models without using MATLAB plug-in. Select the PIC Select the target dspic device here. Default is dspicj256gp710 Optimization Parameters You can enter optimization switches here. Leave it to default if you are not sure as what to use. Compiler Options - You can enter compiler switches here. Leave it to default if you are not sure as what to use. Enter Include Libraries path If you are linking from any specific archives or libraries, you can enter their path here separated with white spaces Header Include Path - If you want to include any headers specifically, you can enter their path here separated with white spaces 18

Building SIMULINK Models Directly Build the model to generate hex/cof file 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 19 Here we show how to directly generate hex/cof files from your SIMULINK model without using the MATLAB Plug-in. Hex/cof files generated can be imported into MPLAB IDE (or any third party programmers) and programmed into your target devices. 19

Summary Use Microchip Device Blockset and MATLAB Plug-In for Code generation Learning Goal: To create SIMULINK models, generate code, build and debug 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 20 That s all you need to use Microchip Device Blocksets and MATLAB Plug-in for MPLAB IDE! Let s summarize what we have learned in this session. We have outlined the steps to use the Microchip Device Blocksets and MATLAB Plug-in for MPLAB IDE. You can use these independently or together. We have demonstrated how you can use them to make your application development faster. Please provide us feedback by visiting our webinar website and click on the Feedback link. What other webinars could be useful to you? 20

Where to Get More Information Other webinars http://www.microchip.com/webinar Discussion board http://forum.microchip.com > Development Tools > MATLAB Support (Knowledge Base and Help Ticket) http://support.microchip.com Collaboration WIKI http://www.microchip.com/wiki 2008 Microchip Technology Incorporated. All Rights Reserved. WebSeminar Title Slide 21 If you are interested in other webinars, please go to http://techtrain.microchip.com/webseminars/archived.aspx for more. You may select Development Tools in the Category for development tools specific webinars. We have a discussion board at http://forum.microchip.com where you can post questions in the user community. You can drill down to the Development Tools then MPLAB IDE Simulator to see questions and answers regarding the simulator and stimulus. You could also go to our support page to see published knowledge base articles and submit a web ticket for our support staff. Lastly, you may collaborate with our customers by visiting our WIKI page on topics related to application development. Thank you for your interest. 21