Upload
leanh
View
219
Download
1
Embed Size (px)
Citation preview
Development Hardwarep
Target Board and In-circuit Debugger
Development Hardware :: Slide 1 of 32David Rye :: MTRX 3700
Microchip PICDEM 2 Plus
Target Board
Development Hardware :: Slide 2 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Development Hardware :: Slide 3 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Development Hardware :: Slide 4 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
2010 Version Very similar to Very similar to
2002 (green/red)
iversion Changed uC
connectors New (PICKIT)
connectorsM f Many surfacemount components
Development Hardware :: Slide 5 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Power 12V Unreg 12V Unreg
to LM340 9V Battery
Power-on LEDLED
Development Hardware :: Slide 6 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
ICSP/ICD(Debug) Port
B#MCLR Button(Reset)
Development Hardware :: Slide 7 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Processor 40 Pin40 Pin 28 Pin 18 Pin
Prototype All ports
brought to SIL headers
Prototype area with +5V, +0V,
Development Hardware :: Slide 8 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Clocking 4MHz 4MHz
Packaged Oscillator(use EC)(use EC)
XTAL RCRC
(J7 enables)(use RC)
Watch Xtal for T1/T3
Development Hardware :: Slide 9 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Inputs
Potentiometer Analog RA0
Push Buttons Digital RA4 Digital RB0Digital RB0
Development Hardware :: Slide 10 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
Outputs
LEDS RB3:RB0 J6 enables J6 enables
16 x 2 LCD Control -RA1:RA3
Data -Data RD0:RD3
Pi B Piezo Buzzer RC2 J9 enables
Development Hardware :: Slide 11 of 32David Rye :: MTRX 3700
PICDEM 2 Plus Demo BoardPICDEM 2 Plus Demo Board
USART MAX232 MAX232,
D9F
I2C Devices Temperature
Sensor 8x256k serial 8x256k serial
EEPROM
Development Hardware :: Slide 12 of 32David Rye :: MTRX 3700
ClockingClocking
Three possible clock sources 4MHz packaged oscillator Remove J7 Use CONFIG OSC=EC
Crystal oscillator Unpopulated on board Remove J7 Use CONFIG OSC=XT (or OSC HS or OSC PLL)
RC oscillator Fit J7 Use CONFIG OSC=RC
Development Hardware :: Slide 13 of 32David Rye :: MTRX 3700
InputsInputs
Potentiometer Analog Input Channel RA0
DIP40 Pin 2
Push Buttons Digital Input RA4
DIP40 Pin 6 RA4 is also T0CKI
Di it l I t RB0 Digital Input RB0 DIP40 Pin 33 RB0 is also INT0RB0 is also INT0
Development Hardware :: Slide 14 of 32David Rye :: MTRX 3700
Outputs LEDSOutputs - LEDS
Four Red LEDSRB3 (pin 36)
Each LED has 470R series resistor RB3 (pin 36)
Also CCP2 RB2 (pin 35)
resistor Jumper J6 enables all LEDS
by connecting (common) RB2 (pin 35) Also INT2
RB1 (pin 34)
by co ect g (co o )cathodes to +0V
RB1 (pin 34) Also INT1
RB0 (pin 33)(p ) Also INT0
Development Hardware :: Slide 15 of 32David Rye :: MTRX 3700
Outputs 2 Line x 16 Character LCDOutputs – 2 Line x 16 Character LCD
COG (Chi O Gl ) tiblCOG (Chip On Glass), compatible with Industry standard Hitachi HD44780 controller
Four Data Bits RD0 (pin 19)
Operates in 4-bit data bus modeRD0 (pin 19) Bit D4 on LCD [This pin also PSP0]
Three Control Bits RA1 (pin 3)
RS (actually C/#D) on LCD
RD1 (pin 20) Bit D5 on LCD [This pin also PSP1]RS (actually C/#D) on LCD
RA2 (pin 4) R/#W on LCD
[This pin also PSP1] RD2 (pin 21)
Bit D6 on LCD [This pin also VREF- for A/D]
RA3 (pin 5) E on LCD latches on falling
[This pin also PSP2] RD3 (pin 22)
E on LCD – latches on falling edge
[This pin also VREF+ for A/D]
Bit D7 on LCD [This pin also PSP3]
Development Hardware :: Slide 16 of 32David Rye :: MTRX 3700
Outputs Piezo BuzzerOutputs – Piezo Buzzer
Driven by a BJT from RC2(pin 17)
Enabled by closing jumper J9(pin 17)
RC2 is also CCP1, so easy to generate tones via PWM…ge e ate to es a
Development Hardware :: Slide 17 of 32David Rye :: MTRX 3700
Serial Devices UARTSerial Devices - UART
USARTUSARTTransmit – RC6/TX (pin 25) Connects to D9F pin 2 Connects to D9F pin 2 [This pin also UART synch. clock, CK]
Receive – RC7/RX (pin 26) Connects to D9F pin 3 [This pin also UART synch. data, DT]
Uses MAX232 RS323 Driver Uses MAX232 RS323 Driver +5V supply only: ±10V from charge
pump driven boost converters D9 pin 4 looped back to pin 6 so that
RTS output asserts CTS input on board
Development Hardware :: Slide 18 of 32David Rye :: MTRX 3700
I2C DevicesI2C Devices
Temperature Sensor U5 Microchip TC74
8x256K serial EEPROM U4 Microchip 27LC256
Accurate to about 2°C Address = 10010101 or 0x9A
[Error in PICDEM2 Manual]
8-pin device 4 address pins, so that 8 can
reside on one bus 2M of[Error in PICDEM2 Manual]
Both U4 and U5 use
reside on one bus 2M of addressable EEPROM
Both U4 and U5 use I2D clock - SCL (pin 18) [This pin also RC3 SCK][This pin also RC3, SCK]
I2D data I/O - SDA (pin 23) [This pin also RC4, SDI][This pin also RC4, SDI]
Development Hardware :: Slide 19 of 32David Rye :: MTRX 3700
Or you can make your own...
Development Hardware :: Slide 20 of 32David Rye :: MTRX 3700
Edward’s Breadboard BoardEdward’s Breadboard Board
Development Hardware :: Slide 21 of 32David Rye :: MTRX 3700
Kirsty’s Plywood BoardKirsty’s Plywood Board
Development Hardware :: Slide 22 of 32David Rye :: MTRX 3700
Microchip ICD 3
In Circuit Debugger
Development Hardware :: Slide 23 of 32David Rye :: MTRX 3700
ICD 3 = In Circuit Debugger 3ICD 3 = In-Circuit Debugger 3
333
Development Hardware :: Slide 24 of 32David Rye :: MTRX 3700
ICD 3 and PICDEM 2 ConnectionsICD 3 and PICDEM 2 Connections
USBPICDEMNEVER
USBCable
PICDEMPowerC t
Disconnect USB with PICDEM
ConnectorBoard powered
PGC/RB6
NEVER Inject signals PGC/RB6
PGD/RB7 Inject signals
into PICDEM when it is notwhen it is not powered
Development Hardware :: Slide 25 of 32David Rye :: MTRX 3700
Power Up SequencePower-Up Sequence
Power-up ICD 3 We will always power the ICD 3 through the USB cable NEVER CONNECT ICD 3 TO POWERED BOARD
IF ICD 3 IS UNPOWERED
Power-up PICDEM 2 Plus board Connect +12V Regulated or Unregulated supply to
socket J2P iti lt t i !! Positive voltage on centre pin!!
Development Hardware :: Slide 26 of 32David Rye :: MTRX 3700
How ICD 3 Works: ConnectionsHow ICD 3 Works: Connections
ICD 3 t l th li NOTEICD 3 controls these lines: PGC (Programming Clock) PGD (Programming Data)
NOTE: Buffers inside ICD 3 are
powered by VDD targPGD (Programming Data) VPP/#MCLR
p y g VSS line between ICD 3
and target not shown.
Also supplies VSS, VDD
Note: 2 pins are ‘lost’: PGC is RB6 PGD is RB7
Development Hardware :: Slide 27 of 32David Rye :: MTRX 3700
How ICD 3 Works: Operation (2)How ICD 3 Works: Operation (2)
P d i Program code into target VPP placed on VPP/#MCLR User code programmed User code programmed
into Program Memory Small Debug Executive is g
also programmed into high Program MemoryW ki t t l k i Working target clock is not required to program
If code does not run on PICIf code does not run on PIC, ICD 3 will not enter debug check oscillator configNote: VDD and VSS
connections not shown
Development Hardware :: Slide 28 of 32David Rye :: MTRX 3700
How ICD 3 Works: Operation (2) (2)How ICD 3 Works: Operation (2) (2)
U d b IDE Use debugger IDE to set breakpoints and run
Halt at a breakpoint and Halt at a breakpoint and inspect/change registers When instruction at
breakpoint address has executed load PC with the address of the Debugthe address of the Debug Executive
Debug Executive transfers gPIC18 internal state back to MPLAB IDENote: VDD and VSS
connections not shown
Development Hardware :: Slide 29 of 32David Rye :: MTRX 3700
Resources Used by ICD 3Resources Used by ICD 3
In-circuit debugging uses the on-chip resources: #MCLR/VPP is shared for programming; Low-voltage ICSP programming is disabled (RB5 is available); RB6 and RB7 are reserved for ICSP/ICD;
T (h d ) k l l il bl Two (hardware) stack levels are not available. Several general purpose file registers are reserved:
0x5EF 0x5FF (0x11 or 17 Bytes) plus some others0x5EF-0x5FF (0x11, or 17 Bytes) plus some others Upper words of program memory area are reserved:
up to 0x7D30-0x7FFF (0x2D0, or 720 Bytes)up to 0 30 0 (0 0, o 0 ytes) Shadow registers are not available. User’s application can use
them, but cannot debug a FAST return because the ICD will overwrite the shadow registers when it gets a breakpoint.
Development Hardware :: Slide 30 of 32David Rye :: MTRX 3700
Detailed Memory Resource UseDetailed Memory Resource Use
The following memory resources are reserved when the IDC 3 is used with the PIC18F452
When Software Breakpoints are NOT used: Program memory: 0x7DC0-0x7FFF Data Memory: 0x5F4-0x5FF; 0xF9C; 0xFD4; 0xFDB-0xFDF;
0xFE3-0xFE7; 0xFEB-0xFEF; 0xFFD-0xFFF When Software Breakpoints ARE used: Program memory: 0x7D30-0x7FFF Data Memory: 0x5EF-0x5FF; 0xF9C; 0xFD4; 0xFDB-0xFDF;
0xFE3-0xFE7; 0xFEB-0xFEF; 0xFFC; 0xFFD-0xFFF
Development Hardware :: Slide 31 of 32David Rye :: MTRX 3700
P18Demo Project
Demonstration code on PICDEM 2 Plus board
Development Hardware :: Slide 32 of 32David Rye :: MTRX 3700