17.05.2015 Views

APP026-3X

APP026-3X

APP026-3X

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

16-bit Elite Program<br />

2009 Spring<br />

Section 3<br />

Microchip 16-bit Family<br />

<br />

Part - 2<br />

Microchip <br />

© 2005 Microchip Technology Incorporated. All Rights Reserved. Slide 1


Exercise - 1<br />

<br />

I/O Port <br />

© 2005 Microchip Technology Incorporated. All Rights Reserved. Slide 2


I/O <br />

<br />

<br />

<br />

<br />

TRISx<br />

<br />

0 : 1 : <br />

PORTx<br />

I/O Port /:: <br />

LATx<br />

I/O Port ( Latch ) ::<br />

ODCx<br />

<br />

<br />

<br />

I/O Open-Drain<br />

Open-Drain 5V I/O <br />

<br />

Pull-up disable , Pull-up<br />

dsPIC30F <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 3


I/O Port<br />

I/O <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 4


I/O <br />

( MCU AC/DC <br />

, Data Sheet)<br />

Vi(max)=5.5V for digital pads<br />

Vi(max)=3.6V for analog pads<br />

Vih(nom)=VDD=3.3V<br />

Vih=0.7*VDD=2.3V<br />

Vil=0.2 * VDD = 0.66V<br />

VDD nominal =3.3V<br />

All digital output pins<br />

can be individually<br />

configured as either<br />

CMOS or Open-drain<br />

output<br />

All pins can source/ sink:<br />

18mA (PIC24F)<br />

4mA (PIC24H/33)<br />

25mA (dsPIC30)<br />

Voh(nom)=VDD=3.3V<br />

Voh=2.6V<br />

Vol=0.4V<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 5


I/O <br />

<br />

PIC24FJ256GB110 Data Sheet <br />

ELECTRICAL CHARACTERISTICS <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 6


CPU Absolute Maximum Value <br />

<br />

PIC24FJ256GB110 Data Sheet <br />

ELECTRICAL CHARACTERISTICS <br />

<br />

Absolute Maximum Rating I/O <br />

sink source , <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 7


I/O PORT <br />

TRISx – PORTD<br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 8


Exercise 1<br />

<br />

:<br />

Step by Step to create your first project !<br />

Debug your first project using <strong>APP026</strong>-<strong>3X</strong><br />

Microchip MPLAB IDE<br />

<br />

<br />

<br />

Project managed development tool<br />

Support Assembly language for all Microchip<br />

MCUs<br />

PIC16 , PIC18 , PIC24 & dsPIC30/33<br />

Able to support C Language<br />

<br />

<br />

User can install C language tools which compatible with<br />

MPLAB IDE<br />

MPLAB C30 will be used for PIC24 & dsPIC30/33<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 9


Exercise 1<br />

Project : MPLAB IDE <br />

<br />

Project <br />

!!<br />

<br />

<br />

<br />

, !!<br />

MPLAB IDE (Template) <br />

(dsPIC30F <br />

PIC24FJ <br />

<br />

D1A.s copy :<br />

<br />

C:\RTC\Elite\D1A.s<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 10


Language<br />

Products<br />

MPASM<br />

Assembler<br />

MPLAB ® IDE<br />

Integrated Development Environment<br />

®<br />

MPLAB<br />

Built-in<br />

Editor<br />

Integrated Development Environment<br />

Low-cost<br />

Debugging<br />

MPLAB SIM<br />

Software<br />

Simulator<br />

Project<br />

Manager<br />

Emulation<br />

and Analysis<br />

MPLAB<br />

REAL ICE<br />

Device<br />

Programmers<br />

PICkit 2<br />

PICkit 3<br />

Source<br />

Level<br />

Debugger<br />

Third Party<br />

Tools<br />

Compilers<br />

IAR,<br />

CCS,<br />

ME Labs,<br />

Green Hills<br />

MPLINK<br />

MPLIB<br />

MPLAB ICE<br />

2000 & 4000<br />

MPLAB PM3<br />

PICSTART<br />

Plus<br />

Real-time Operating<br />

Systems<br />

CMX, Vector,<br />

Realogy, Express<br />

Logic<br />

MPLAB C18<br />

MPLAB C30<br />

MPLAB C32<br />

Hi-TECH C<br />

PICkit 2 & PICkit 3<br />

MPLAB ICD 2 & MPLAB ICD3<br />

MATLAB<br />

Live Devices, CMX,<br />

Momentum Data<br />

Systems<br />

Uniquely supporting 8, 16 and 32 bit processors<br />

within one integrated development environment!<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 11


MPLAB IDE <br />

<br />

Microchip MPLAB IDE <br />

– It’s free <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 12


Features/Speed/Trace<br />

<br />

<br />

PICkit 2<br />

Full Speed HID<br />

USB,<br />

1 Device Family<br />

per Loader,<br />

Run, Halt, SS,<br />

Program, Read<br />

Full Speed Emul<br />

Select Devices<br />

$50<br />

MPLAB ICD 2<br />

Serial, Full Speed<br />

Custom USB,<br />

Run, Halt, SS,<br />

Complex Trigger/<br />

Break<br />

Stopwatch,<br />

Program, Read<br />

Full Speed Emul<br />

PIC10F, 12F, 16F<br />

PIC18F, PIC24,<br />

dsPIC<br />

MPLAB<br />

REAL ICE<br />

High Speed<br />

Custom USB,<br />

Run, Halt, SS<br />

Complex<br />

Trigger/Break,<br />

Real Time Watch,<br />

Stopwatch,<br />

Program, Read,<br />

Dynamic Trace,<br />

Logic Probes,<br />

LVDS<br />

Full Speed Emul<br />

PIC16F 1 , PIC18F,<br />

PIC24, dsPIC<br />

MPLAB ICE 2000<br />

Parallel,<br />

USB Option<br />

Run, Halt, SS,<br />

Complex Trigger/<br />

Break,<br />

Static Trace,<br />

Logic Probes,<br />

Flexible circuit cable<br />

20 MIPS Emul<br />

PIC10F, 12F, 16C 2 ,<br />

PIC16F, PIC17C 2 ,<br />

PIC18C 2 , PIC18F<br />

$150 $500 $1500<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 13


Features/Speed/Trace<br />

PICkit 3<br />

Full Speed USB HID,<br />

Run, Halt, SS,<br />

Simple Breakpoints,<br />

Program, Read<br />

All of Microchip’s Flash<br />

PIC® MCU and dsPIC<br />

DSCs<br />

MPLAB ® ICD 3<br />

High Speed USB 2.0,<br />

Run, Halt, SS<br />

Software Breakpoints,<br />

Complex<br />

Breakpoints,<br />

Stopwatch,<br />

Program, Read,<br />

All of Microchip’s Flash<br />

PIC ® MCUs and dsPIC ®<br />

DSCs<br />

MPLAB REAL ICE<br />

Emulator<br />

High Speed<br />

USB 2.0,<br />

Run, Halt, SS<br />

Software Breakpoints, Complex<br />

Breakpoints/Triggers,<br />

Stopwatch,<br />

Program, Read,<br />

Real-Time Watch,<br />

Trace,<br />

Logic Probes,<br />

Performance Pak<br />

All of Microchip’s Flash PIC<br />

MCUs and dsPIC DSCs<br />

$70<br />

$220 $500<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 14


Microchip 16-bit MCU <br />

( ASM30)<br />

<br />

ASM30 Tool Suite Microchip 16-bit MCU<br />

<br />

<br />

<br />

<br />

<br />

(Assembler) – pic30-as.exe<br />

<br />

Relocatable obj <br />

Obj (machine-code) ,<br />

<br />

(Linker) – pic30-ld.exe<br />

<br />

<br />

Assembler obj , obj<br />

<br />

<br />

<br />

<br />

MPLAB LINK30 .hex <br />

( call , goto )<br />

<br />

Linker library <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 15


Assembler / Linker <br />

Assembly<br />

Source<br />

Assembly<br />

Source<br />

Libraries<br />

Assembler<br />

Linker<br />

Program Memory Address<br />

0x0000 goto __reset <br />

Object File<br />

Object File<br />

Execution File<br />

__reset <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 16


D1A.s (1)<br />

.text<br />

;Start of Code section<br />

__reset:<br />

MOV #SP_init, W15 ;Initalize the Stack Pointer<br />

MOV #SPLIM_init, W0 ;Initialize the Stack Pointer Limit Register<br />

MOV<br />

W0, SPLIM<br />

NOP<br />

;Add NOP to follow SPLIM initialization<br />

CALL _wreg_init ;Call _wreg_init subroutine<br />

;Optionally use RCALL instead of CALL<br />

;<br />

;..............................................................................<br />

;Subroutine: Initialization of W registers to 0x0000<br />

;..............................................................................<br />

_wreg_init:<br />

CLR<br />

W0<br />

MOV<br />

W0, W14<br />

REPEAT #12<br />

MOV<br />

W0, [++W14]<br />

CLR<br />

W14<br />

RETURN<br />

ASM30 <br />

(crt0.o) <br />

LINK30 __reset<br />

_main<br />

From 2.2.3 of dsPIC30F Family Reference Manual<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 17


D1A.s (2)<br />

.include "P24FXXXX.inc"<br />

.equ SAMPLES, 64 ;Number of samples<br />

;..............................................................................<br />

;Global Declarations:<br />

;..............................................................................<br />

.global _wreg_init ;Provide global scope to _wreg_init routine<br />

;In order to call this routine from a C file,<br />

;place "wreg_init" in an "extern" declaration<br />

;in the C or other .s file.<br />

.global __reset ;The label for the first line of code.<br />

.global __T1Interrupt ;Declare Timer 1 ISR name global<br />

;..............................................................................<br />

;Constants stored in Program space<br />

;..............................................................................<br />

.section<br />

.palign 2<br />

.myconstbuffer, code<br />

ps_coeff:<br />

.hword 0x0002, 0x0003, 0x0005, 0x000A<br />

;..............................................................................<br />

;Uninitialized variables in Near data memory (Lower 8Kb of RAM)<br />

;..............................................................................<br />

;Align next word stored in Program space to an<br />

;address that is a multiple of 2<br />

.section .nbss, bss, near<br />

var1: .space 2 ;Example of allocating 1 word of space for<br />

;variable "var1".<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 18


D1A.s <br />

<br />

<br />

C:\Program Files\Microchip\MPLAB ASM30<br />

Suite\Support\Template\Assembly\tmp6014.s<br />

<br />

<br />

<br />

Var1 , Var2 <br />

…<br />

<br />

<br />

<br />

5 Var1 , 10Var2<br />

<br />

<br />

C:\Program Files\Microchip\MPLAB ASM30 Suite<br />

\Support\Templates\Assembly\tmp6014_srt.s<br />

<br />

<br />

<br />

C:\Program Files\Microchip\MPLAB ASM30 Suite<br />

\lib\Crt0.o<br />

User __reset , _main <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 19


Exercise 1 – <br />

<br />

<br />

<br />

<br />

MPLAB Project Wizard <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 20


Exercise 1 – Project Wizard<br />

Project Wizard : Device <br />

PIC24FJ128GB106<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 21


Exercise 1 – Project Wizard<br />

Project Wizard : <br />

Microchip ASM30 Toolsuite<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 22


Exercise 1 – Project Wizard<br />

Project Wizard : Project <br />

”Browse”<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 23


Exercise 1 – Project Wizard<br />

<br />

Project Wizard : Project <br />

<br />

””()<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 24


Exercise 1 – Project Wizard<br />

<br />

“”<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 25


Exercise 1 – Project Wizard<br />

<br />

Project Wizard : (1)<br />

<br />

Add C:\RTC\Elite\DA1.s <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 26


Exercise 1 – Project Wizard<br />

<br />

<br />

<br />

Project Wizard : (2) .gld <br />

C:\Program Files\Microchip\MPLAB ASM30 Suite\Support\pic24F\gld\p24FJ128GB106.gld<br />

.gld , Linker , C30 <br />

MPLAB IDE V8.30 ASM30 Suite ASM30 gld <br />

User .gld , Project .<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 27


Exercise 1 – Project Wizard<br />

Project Wizard : Summary<br />

!!<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 28


Exercise 1 – Project Wizard<br />

Project Wizard : Summary click<br />

”Finish”<br />

<br />

click DA1.s <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 29


Exercise 1 – Project Wizard<br />

<br />

<br />

<br />

<br />

Debug : Project Build Debugger <br />

<br />

MPLAB ASM30 Suite Debugger <br />

Release : Project Build , <br />

Program MCU<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 30


Exercise 1 – Project Wizard<br />

<br />

“View” <br />

MPLAB IDE User <br />

<br />

“View” , Project & Output <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 31


Exercise 1 – Build Project<br />

D1A.s , <br />

Build<br />

( .hex )<br />

Project -> Build All<br />

<br />

Assembly LINK<br />

Project -> Make<br />

<br />

Assembly LINK<br />

Make Build All <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 32


Exercise 1 – Build Project<br />

Build All & Make <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 33


Exercise 1 – Build <br />

<br />

, BUILD<br />

SUCCESSED <br />

<br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 34


Exercise 1 – <br />

:<br />

INPUT 1<br />

OUTPUT LED1<br />

, , goto <br />

/<br />

<br />

<br />

1 (LOW) LED1 <br />

1 (HIGH) LED1 <br />

, <br />

CNx Weak Pull-up !! (RP2)<br />

CNx PIC24FJXXXX PORTB <br />

<strong>APP026</strong>-<strong>3X</strong> <br />

RP2 , Internal weak pull-up<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 35


Exercise 1<br />

Microchip 16-bit Family <br />

<br />

<strong>APP026</strong>-<strong>3X</strong> PIC24FJ128GB106<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 36


<strong>APP026</strong>-<strong>3X</strong> PICkit 2 module<br />

<br />

<br />

<br />

LCD Display <br />

PICkit 2 <br />

<br />

Power Target<br />

Board<br />

EEPROM 24LC512 * 2 ,<br />

Programmer to go<br />

<br />

24LC512 <br />

PICkit 2 <br />

2.54mm * 6-Pin ICD 2<br />

RJ-11 Connector <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 37


PICKit 2 <br />

<br />

<br />

<br />

MPLAB ICD 2 , <br />

MPLAB IDE Microchip Flash<br />

MCU <br />

<br />

<br />

<br />

<br />

Programmer or Debugger <br />

PICKit 2 <br />

PIC16F , PIC18F<br />

PIC24FJ , PIC24HJ & dsPIC33FJ<br />

dsPIC30F<br />

HID Device Class , <br />

MPLAB ICD 2 <br />

ICD 2 <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 38


Exercise 1<br />

Microchip 16-bit Family <br />

<br />

<strong>APP026</strong>-<strong>3X</strong> PIC24FJ128GB106<br />

VR1 & VR2<br />

<br />

JP2- Vdd <br />

(3.3V/5V)<br />

JP5&JP6 – CPU<br />

JUMPER<br />

CON1-9V<br />

DC <br />

JP20 - USB <br />

64-Pin CPU<br />

<br />

CON4-LCD<br />

<br />

X2 –<br />

32.768Hhz<br />

PICKit<br />

2 USB<br />

Connector<br />

X1 – 8Mhz<br />

<br />

JP19- <br />

LED <br />

<br />

PICKit 2 module<br />

Debug <br />

Debug <br />

JP8-ENVREG<br />

for PIC18J JP9&JP10 CON11 4.7K<br />

ICD2 & PICKit 2 Connector<br />

Pull-up * 4<br />

S1-S4<br />

LED1 – LED4<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 39


PIC24FJ128GB106 <br />

<br />

Microchip 16-bit MCU Family<br />

<br />

64-Pin TQFP , 128KB Program Memory<br />

USB ( HOST & Device )<br />

UART * 4 , SPI * 3 , I2C * 3<br />

PWM(OC) * 9 , Capture-In * 9<br />

10-bit AD * 16<br />

(Comparator) * 3<br />

<br />

<br />

PMP + PSP<br />

CTMU – <br />

PPS ( Peripheral Pin Select )<br />

<br />

<br />

I/O /<br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 40


PIC24FJ128GB106 – RPxx<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 41


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

JP2 VDD ( 3.3V or 5V)<br />

<br />

MCU , Power-On <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 42


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

<br />

<br />

<strong>APP026</strong>-3 JP2 VDD 3.3V or 5V , 5V <br />

, 3.3V MCP170X LDO 5V 3.3V <br />

JP1 5V-SOURCE5VUSB or <br />

7805 <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 43


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

JP1 5V-SOURCE5VUSB , <strong>APP026</strong>-<strong>3X</strong> <br />

CON15-USB PC USB Port USB connector <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 44


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

JP1 5V-SOURCE5V7805 , <br />

<strong>APP026</strong>-<strong>3X</strong> CON1 9V DC Power <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 45


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

<strong>APP026</strong>-<strong>3X</strong> PICkit2 Debug , CON18-USB1 PC USB<br />

Port<br />

5V CON18-USB1 5V VBUS<br />

CON18A Pin2 5V +5V Connector<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 46


<strong>APP026</strong>-<strong>3X</strong> <br />

PICKit 2<br />

<strong>APP026</strong>-<strong>3X</strong> PICKit 2 HID , Driver !!<br />

<br />

<br />

<br />

<br />

USB PC <strong>APP026</strong>-<strong>3X</strong> <br />

CON19 CON19A , Debug<br />

6P CON19A CON12 <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 47


<strong>APP026</strong>-<strong>3X</strong> <br />

Debugger Pin <br />

CON18-USB 5V VBUS , <br />

<strong>APP026</strong>-<strong>3X</strong> PIC24FJ128GB106 64-pin TQFP MCU<br />

PIC24FJ128GB106 3 Debug/Program , <strong>APP026</strong>-<strong>3X</strong> 1 , 2 <br />

JP15 &JP16 JUMPER , PGEC1/PGED1 Debug ..<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 48


!!<br />

D1A.s <br />

© 2005 Microchip Technology Incorporated. All Rights Reserved. Slide 49


I/O Pin <br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

I/O Pin CPU RESET Digital Input<br />

()<br />

I/O Pin 5V !!<br />

RD1<br />

RD1 (Pin-49) JP19 S1 Pin <br />

LED<br />

<br />

<br />

<br />

<br />

<br />

I/O <br />

RD0<br />

RD0 (Pin-46) JP19 LED1 <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 50


<strong>APP026</strong>-<strong>3X</strong> <br />

<br />

<br />

<br />

<strong>APP026</strong>-<strong>3X</strong> MCU <br />

LED <br />

S1 Normal High<br />

LED High <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 51


Microchip 16-bit MCU <br />

, <br />

BSET / BCLR<br />

BTST ..<br />

BRA ..<br />

BRA or goto<br />

MPLAB IDE <br />

<br />

, Label <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 52


, <br />

Test_Loop , LED_Off , LED_On Label<br />

Lable Program Memory <br />

Lable , <br />

Data Memory Symbol <br />

PORTD, TRISD MPLAB ASM30 Symbol <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 53


Symbol <br />

<br />

<br />

<br />

<br />

Wn Data<br />

Memory <br />

SFR (PORTD) Data Memory <br />

SFR ASM30 .gld <br />

, <br />

<br />

BTST PORTD,#1 BTST 0x02DA,#1<br />

User Symbol D1A.s<br />

<br />

<br />

Var1 nbss near <br />

near data memory (8K Data Memory )<br />

Linker build Var1<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 54


Exercise 1 – <br />

Release / Debug , <br />

PICKit 2 or ICD2 , Debug<br />

Why ?<br />

PICKit2 , ICD 2 Real ICE <br />

CPU <br />

Debug LINK30 <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 55


uild <br />

<br />

<br />

<br />

“ Build” (Assembly) <br />

Link<br />

Build <br />

MCU <br />

Build All Make <br />

<br />

<br />

<br />

<br />

Build All : Link<br />

Make : Link<br />

source file <br />

Build All <br />

Make <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 56


Build Succeeded<br />

Build Output <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 57


Build FAILED !!<br />

Double-Click <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 58


Build <br />

<br />

<br />

Output double click <br />

, Build (LATd LATD)<br />

Symbol & Label !!<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 59


Exercise 1 – Debug <br />

Build , Debug ?<br />

MPLAB PICkit 2 Debugger<br />

<br />

MPLAB IDE Debugger <br />

<br />

“Re-establish PICkit 2 connection ” <br />

Reset and Connect to ICD<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 60


Exercise 1 – Debug <br />

PICkit 2 PIC24FJ128GB106 <br />

<br />

<br />

Re-establish PICkit 2 connection Output<br />

Window<br />

Debugger <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 61


PICkit 2 ?<br />

<br />

<br />

Debugger <br />

‘Setting” <br />

User <br />

<br />

Connect on startup <br />

, <br />

PICkit 2 <br />

Debugger <br />

MPLAB IDE <br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 62


Exercise 1 - <br />

<br />

PICkit 2 MCU (1)<br />

Configuration Bits ! <br />

<br />

Fast RC Oscillator (FRC)<br />

EVM Board <br />

PIC24FJ128GB106<br />

Internal FRC !!<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 63


Exercise 1 - <br />

<br />

PICkit 2 MCU (2)<br />

<br />

<br />

Configuration Bits Comm Channel Select <br />

<br />

JP15 & JP16 Jumper , PGEC1/PGED1 <br />

Debug<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 64


Exercise 1 - <br />

<br />

PICkit 2 MCU<br />

Program Target Device Device<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 65


Exercise 1 – <br />

<br />

PICkit 2 Debug <br />

Debug <br />

<br />

, Build , Program <br />

Step Into<br />

Step Over<br />

Animate<br />

Run<br />

Reset<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 66


Exercise 1 – <br />

<br />

Run : <br />

<br />

Animate : <br />

Step Into<br />

Step Over<br />

<br />

<br />

<br />

<br />

<br />

<br />

delay Animate<br />

<br />

Step Into : <br />

<br />

Step Over : call <br />

, <br />

Animate<br />

<br />

<br />

Step Over <br />

Run<br />

<br />

Reset : MCU <br />

Reset<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 67


Exercise 1 – <br />

<br />

<br />

<br />

<br />

<br />

<br />

double click<br />

<br />

<br />

“Set Breakpoint”<br />

<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 68


Exercise 1 – <br />

<br />

<br />

MCU <br />

<br />

PIC24FJ128Gb106 4 <br />

<br />

double click<br />

<br />

“Remove Breakpoint”<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 69


Exercise 1 – Watch <br />

<br />

<br />

View Watch<br />

Watch <br />

Watch <br />

SFR ( <br />

) <br />

Symbol<br />

<br />

User <br />

Var1<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 70


Exercise 1 – Watch <br />

<br />

Watch ?<br />

Symbol Name <br />

Address <br />

<br />

Symbol mark Watch <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 71


Exercise 1 – Watch <br />

Watch window <br />

<br />

<br />

Symbol , <br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 72


Exercise 1 Summary<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

16-bit PIC ® MCU Assembler <br />

MPLAB IDE <br />

<br />

<strong>APP026</strong>-<strong>3X</strong> <br />

<strong>APP026</strong>-<strong>3X</strong> PICkit 2 debug<br />

Debug <br />

PICkit 2 Debug !!<br />

<br />

Watch Window …<br />

… !!<br />

© 2006 Microchip Technology Incorporated. All Rights Reserved. 1005 GS5 Slide 73

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!