Getting started with MPLAB Launch MPLAB Set Toolbar as in the next slide by clicking the leftmost icon Open a new Source file by choosing [FILE][NEW] Type.

Slides:



Advertisements
Similar presentations
Use of MPLab software Paul Cockshott. PIC KIT Get the kit Kits are locked in cupboard Get from lab supervisor Plug into the usb port on your computer.
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
South Dakota Library Network ALEPH v20 Tables © South Dakota Library Network, 2012 ©Ex Libris (USA), 2009 Modified for SDLN Version Last Update:
OCFS Data Warehouse Basic Training
Introduction to HT-IDE3000 Micro-C development System Department.
Using the SmartPLS Software
AIMSweb Progress Monitor Online User Training
Verilog Intro: Part 1.
Code Composer Department of Electrical and Computer Engineering
Copyright  Oracle Corporation, All rights reserved. 1 Creating an Application: The AppBuilder for Java IDE.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Personal Planning System Enterprise Edition The Completing the Monthly Review.
Logging In Go to web site:
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
How to Debug VB .NET Code.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
DEMONSTRATION FOR SIGMA DATA ACQUISITION MODULES Tempatron Ltd Data Measurements Division Darwin Close Reading RG2 0TB UK T : +44 (0) F :
Google Earth How to create a Google Earth Tour and place it in your Wiki.
Chapter 2 Software Tools and Assembly Language Syntax.
Visual Basic Chapter 1 Mr. Wangler.
05/09/ Introducing Visual Basic Sequence Programming.
P.1ECE 331, Prof. A. Mason Professor Andrew Mason Michigan State University Spring 2013 ECE 331: PC Lab 1: Using HC12 ASM Simulators.
PMS /134/182 HEX 0886B6 PMS /39/80 HEX 5E2750 PMS /168/180 HEX 00A8B4 PMS /190/40 HEX 66CC33 By Adrian Gardener Date 9 July 2012.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
CPS120: Introduction to Computer Science Compiling Your Programs Using Visual C++
ADAM2 Single Remocon MCU IDE User’s Manual S/W Integrated Development Environment - Assembler - Simulator - Code Wizard V1.0 Technical Sales Team, ETA.
Office 2003 Advanced Concepts and Techniques M i c r o s o f t Access Project 5 Enhancing Forms with OLE Fields, Hyperlinks, and Subforms.
Getting Started With AutoCAD ENGR 2 Week #1 Laboratory.
Active-HDL Interfaces Debugging C Code Course 10.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Page 1 Non-Payroll Cost Transfer Enhancements Last update January 24, 2008 What are the some of the new enhancements of the Non-Payroll Cost Transfer?
Working with the VB IDE. Running a Program u Clicking the”start” tool begins the program u The “break” tool pauses a program in mid-execution u The “end”
Data Structures and Debugging Dr. Nancy Warter-Perez June 18, 2003.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Debugging Visual Basic.NET Programs ► ► Use debugging tools ► ► Set breakpoints and correct mistakes. ► ► Use a Watch and Local window to examine variables.
GISMO/GEBndPlan Overview Geographic Information System Mapping Object.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Bit-DSP-MicrocontrollerTMS320F2812 Texas Instruments Incorporated European Customer Training Center University of Applied Sciences Zwickau (FH)
CS320n –Visual Programming More LabVIEW Foundations.
Fall 2003Sylnovie Merchant, Ph.D. ACCESS Tutorial Note: The purpose of this tutorial is to provide an introduction to some of the functions of ACCESS in.
Slide Show: Using Idea Machine Templates
Introduction to Excel VBA UNC Charlotte CPE/PDH Series December 17, 2009.
PowerPoint Practice Exercise 1.Save this file on your computer. 2.Open this file in PowerPoint 3.Edit each slide according to the instructions provided.
Copyright 2006 by Timothy J. McGuire, Ph.D. 1 MIPS Assembly Language CS 333 Sam Houston State University Dr. Tim McGuire.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are used in programs so that values can be represented with.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Visual Basic.NET Windows Programming
Development Environment
A variable is a name for a value stored in memory.
Chapter 2: The Visual Studio .NET Development Environment
Use of MPLab software Paul Cockshott.
PRU-ICSS Programming with CCS
Enhancing Forms with OLE Fields, Hyperlinks, and Subforms
Using Visual Studio with C#
Getting started with MPLAB7
Debugging with Eclipse
Introduction to Programming
Debugging Taken from notes by Dr. Neil Moore
ECE 3567 Microcontroller Lab
CSC235 - Visual Studio Tutorial
Debugging Taken from notes by Dr. Neil Moore
Debugging with Eclipse
Presentation transcript:

Getting started with MPLAB Launch MPLAB Set Toolbar as in the next slide by clicking the leftmost icon Open a new Source file by choosing [FILE][NEW] Type in your program Rules for the Microchip assembler: Comments begin with a ; Labels (names) begin in column 1 (Leftmost) and by style should be UPPERCASE Instructions should not begin in column 1 and by style should be lowercase The last directive should be end (comments can come after) Save your file [FILE][SAVE AS] on your floppy in a subdirectory called myfiles Rules for file naming: Names should not be more than 8 alphanumeric characters, not beginning with a number, underscore is acceptable character The extension should always be.asm ; e.g. example1.asm

Make a new Project [PROJECT][NEW] Give your project a name, normally the same as your program name with an extension of.pjt ; e.g. example1.pjt and ensure that it is targeted to your folder in the floppy! If {Development Mode} window does not show MPLAB SIM then use the [Change] button to alter

Click the [Add Node] button and pick your presaved source file, in the case below example1.asm on your floppy

Assemble your code by picking [PROJECT][MAKE] or hit {F10} If there are NO syntax errors then you should see something like this:

If you had a syntax error (For this example I changed addlw to addwl ), then something like below will occur: To correct the errors then read the error description which in this case is in line 11 Illegal character. Double click on error and the cursor will move to the appropriate line in the source code. The clue is the warning Found label after column 1. (addwl) As it did not recognise the illegal instruction addwl it thought it was a label in the wrong place. Make the appropriate change(s) and reassemble {F10}

Prepare for simulation by setting up a Watch window to monitor the variables, File registers Pick menu [Window][Watch Windows][New Watch Windows] or click on the icon. Add the appropriate variables; NUM and SUM in this example

To modify a value in the Watch window: Double-click the variable; e.g. NUM In the resulting Modify window input the datum byte in hex (or decimal) and click the [Write] button The altered value is shown in the Watch window in red When changes are finished click the [Close] button

To run your program by single stepping: Reset the simulated PIC by either using the [DEBUG][SYSTEM RESET] menu or the Reset icon You can single-step the system using Single-Step icon or else use the [DEBUG] menu A coloured bar will move down the source code as you step through the program and the variables will alter in the Watch window (variable values can be changed on the fly. The Working register, Program Counter and values of the three flags are shown lower case for 0 and Upper case for 1 The program can be set any time and Watched variable altered for each run. In addition clicking on the top left icon of the Watch window allows variable to be added or properties altered (such as changing from hex to decimal or binary

To run your program by animation First set a breakpoint by right clicking on the instruction you wish the program to stop (you can have several breakpoints and run down to each one in sequence) Reset the system Choose [DEBUG][RUN][ANIMATE] The program will execute a few instructions a second and stop when the breakpoint is reached. To run at high speed then: Set up a breakpoint Use the green icon or the [DEBUG][RUN][RUN] menu You can use the red icon to stop the simulation at any time

To monitor the execution time of your program using the Stopwatch Before running your program go to the [Window] menu and pick [Stopwatch] The Stopwatch window shown below appears. Cycles shows the number of internal cycles (¼ crystal frequency) as the program progresses Time is the actual time which depends on the xtal frequency Normally both the above are zeroed on reset If the program is single-stepped or animated then the Stopwatch is updated on the fly, as is the Watch window If the run is at high speed then the final outcome is displayed when the breakpoint is reached; see next slide Note: The simulated crystal frequency may be changed from the [OPTIONS][DEVELOPMENT] menu

For example for a 20MHz crystal:

Using the Trace memory facility For serious debugging it is useful to have a log of the state of the program as the simulation progresses. Highlight all instructions you wish the log to be recorded and then right click; for example:

The trace instructions will be highlighted in green (the red breakpoint can also be seen below Single instructions can be right-clicked and added to the trace repertoire. More control over the process can be had from the [DEBUG] menu

Now run the program in the usual way. When finished selecting [WINDOW][TRACE MEMORY]. This brings up a text file showing: Each instruction as it was executed The time and number of cycles since reset Each file altered by the instruction; e.g. below line 8 shows File 21h (the loop count) going to 08 and File 3 (STATUS) to 19h The display below was set to [Source code display] by clicking the top left icon which gives various display options The file can be saved and printed etc selecting [File][EXPORT TRACE MEMORY] and giving the file a name Up to around 8,000 trace lines are possible

Using MPLAB with the CCS C compiler Launch MPLAB Open a new Source file by choosing [FILE][NEW] Type in your program Save your file [FILE][SAVE AS] on your floppy in a subdirectory called myfiles Rules for file naming: Names should not be more than 8 alphanumeric characters, not beginning with a number, underscore is acceptable character The extension should always be.c ; e.g. exam16.c

Make a new Project [PROJECT][NEW] Give your project a name, normally the same as your program name with an extension of.pjt ; e.g. exam16.pjt and ensure that it is targeted to your folder in the floppy!

Change the {Language Tool} window to CCS. Select the.hex file in the {Project Files} window and then the [Node Properties] button. When the [Node Properties] window comes up (bottom left) click on the [OK] button. On return then click on the [Add Node] button and select the source file; for example exam16.c (bottom right).

Assemble your code by picking [PROJECT][MAKE] or hit {F10} If there are NO syntax errors then you should see something like this:

If you had a syntax error (For this example I changed i++; to j++; ), then something like below will occur: To correct the errors then read the error description which in this case is in line 9 Unidentified identifier j. Double click on error and the cursor will move to the appropriate line in the source code. Make the appropriate change(s) and reassemble {F10}. Many errors are not so easy to locate as this. Look out for comments with a start /* and no end comment */

You can use a Watch window to monitor a C program in the same way as an assembly-level program, but variables defined inside a function will have the form function.variable; e.g. main.number. Global variables do not have a function name prefix; e.g. TENS.