vin
“Low-Pincount Workshop”
Uporaba MPLAB MPLAB ® ® IDE &
FLASH Starter Kit PICkit TM 1
“Low-Pincount Workshop”
Uporaba MPLAB MPLAB ® ® IDE &
FLASH Starter Kit PICkit TM 1
vin
Izvedba:
Izvedba:
Izvedba:
Izvedba:
Elbacomp
Elbacomp
vin Urnik: Urnik: Urnik: Urnik:
Predstavitev in PC / MPLAB
nastavitve 9:00 - 9:20
PICkit TM 1 – Start 9:20 -9:40
Kaj je MPLAB MPLAB ® ® 7.xx 9:40 -10:00
Več o PicKit-1 10:00 -10:45
Praktična uporaba PICkit TM 1 11:00-12:30
Arhitektura PIC12F675 13:30-14:00
Primeri programov 14:00-15:45
Pregled razvojnih orodij 15:45-16:00
Predstavitev in PC / MPLAB
nastavitve 9:00 - 9:20
PICkit TM 1 – Start 9:20 -9:40
Kaj je MPLAB MPLAB ® ® 7.xx 9:40 -10:00
Več o PicKit-1 10:00 -10:45
Praktična uporaba PICkit TM 1 11:00-12:30
Arhitektura PIC12F675 13:30-14:00
Primeri programov 14:00-15:45
Pregled razvojnih orodij 15:45-16:00
vin
Predstavitev Predstavitev Elbacomp d.o.o.
Elbacomp d.o.o.
in in
Microchip Technology Microchip Technology
Predstavitev Predstavitev Elbacomp d.o.o.
Elbacomp d.o.o.
in in
Microchip Technology
Microchip Technology
vin Corporate Overview Corporate Overview Corporate Overview Corporate Overview
Leading semiconductor manufacturer:
of high-performance, field-programmable, 8-bit & 16-bit RISC Microcontrollers
of Analog & Interface products
of related Memory products
for high-volume embedded control applications
$572M in product sales in FY02, $700M run rate today
Almost 3,000 employees
Headquartered near
Phoenix in Chandler, AZ
“The Silicon Desert”
Leading semiconductor manufacturer:
of high-performance, field-programmable, 8-bit & 16-bit RISC Microcontrollers
of Analog & Interface products
of related Memory products
for high-volume embedded control applications
$572M in product sales in FY02, $700M run rate today
Almost 3,000 employees
Headquartered near
Phoenix in Chandler, AZ
“The Silicon Desert”
vin Worldwide Technical Support Worldwide Technical Support Centers & Manufacturing Facilities Centers & Manufacturing Facilities
Detroit Chicago
Toronto
Boston San Jose
Los Angeles New York
Dallas
Atlanta
London Paris
Milan
Munich
Shin-Yokohama
Bangalore
Hong Kong Taipei
Seoul
Singapore
Shenzhen Beijing
• .
• .
Phoenix
Kaohsiung Chengdu
Fuzhou
Sydney Kokomo
•
Copenhagen.
• .
Qingdao
Shanghai
Arizona Manufacturing and
Corporate HQ
Oregon Oregon
Manufacturing Manufacturing
Shanghai Shanghai Test & Assembly Test & Assembly
Bangkok
Test & Assembly
vin
PICkit
PICkit TM TM 1 1
FLASH Starter Kit FLASH Starter Kit
Start
Start …... …...
PICkit
PICkit TM TM 1 1
FLASH Starter Kit FLASH Starter Kit
Start
Start …... …...
vin
vin FLASH Starter Kit FLASH Starter Kit PICkit PICkit TM TM 1 1 PICkit
PICkit TM TM 1 1
FLASH Starter Kit
FLASH Starter Kit
vin PICkit PICkit TM TM 1 Hardware Features 1 Hardware Features
The Programmer The Programmer
PICkit
PICkit TM TM 1 Hardware Features 1 Hardware Features
The Programmer The Programmer
•Uses PIC16C745
•CCP Driven Charge pump for Vpp voltage.
•USB Powered.
•Can write 1k words in 8 seconds.
•Minimum parts count for
minimum cost.
vin PICkit PICkit TM TM 1 Hardware Features 1 Hardware Features
The 8/14 pin Evaluation The 8/14 pin Evaluation
PICkit
PICkit TM TM 1 Hardware Features 1 Hardware Features
The 8/14 pin Evaluation The 8/14 pin Evaluation
•Supports 8/14 pin Flash devices
•Programmed via ICSP
•Includes a button
& Potentiometer
•Shows
multiplexing of 12 LED’s (8
provided)
•I/O pins are attached to an
expansion header.
vin PICkit PICkit TM TM 1 Hardware 1 Hardware
Prototyping Area Prototyping Area
PICkit
PICkit TM TM 1 Hardware 1 Hardware
Prototyping Area Prototyping Area
Innovative Snap-off Prototyping area
Patterns placed for RS-232 interface & 5v power supply.
Pattern also placed for 14 pin DIP & decoupling capacitor
Innovative Snap-off Prototyping area
Patterns placed for RS-232 interface & 5v power supply.
Pattern also placed for 14 pin
DIP & decoupling capacitor
vin PICkit PICkit PICkit PICkit TM TM TM TM 1 GUI 1 GUI 1 GUI 1 GUI
GUI runs
independently from MPLAB.
GUI gives access to all PICkit TM 1
features.
Read/write/erase/verify
Source code for GUI
is provided.
vin PICkit PICkit PICkit PICkit TM TM TM TM 1 Package Features 1 Package Features 1 Package Features 1 Package Features
•PICkit TM 1 Hardware Kit
•USB cable
•Quickstart Guide
•Tips n’ Tricks
•MPLAB ® CDROM
•PICkit TM 1 CDROM Users Manual
Example Software
PICkit TM 1 Programmer GUI
vin Getting Started Getting Started Getting Started Getting Started
Install PICkit TM 1 CD-ROM
Select Quick Start / Install PICkit TM 1 Software from menu
Connect USB cable to PC and PICkit TM 1
Demonstration software has already been downloaded to the PICmicro in the PICkit TM 1
For proper operation
LEDs will sequentially blink ON and OFF
Press switch SW1 to reverse blinking sequence
Install PICkit TM 1 CD-ROM
Select Quick Start / Install PICkit TM 1 Software from menu
Connect USB cable to PC and PICkit TM 1
Demonstration software has already been downloaded to the PICmicro in the PICkit TM 1
For proper operation
LEDs will sequentially blink ON and OFF
Press switch SW1 to reverse blinking sequence
vin Directories….. Directories….. Directories….. Directories…..
PICkit TM 1 Flash Starterkit : use defaults
MPLAB ® 6.xxx: use defaults
Workshop-files: c:\lessons
PICkit TM 1 Flash Starterkit : use defaults
MPLAB ® 6.xxx: use defaults
Workshop-files: c:\lessons
vin MPLAB MPLAB ® ® IDE CD IDE CD
User Guides
Dev Tools Guide 3rd Party Guide
Data sheets w/ errata’s Free Demo Compilers
Quarterly Product Line Card User Guides
Dev Tools Guide 3rd Party Guide
Data sheets w/ errata’s Free Demo Compilers
Quarterly Product Line Card
DS51123
It’s Free!
vin MPLAB MPLAB ® ® 7 7 .xx .xx
Predstavitev Predstavitev kako uporabiti
kako uporabiti ….. …..
MPLAB
MPLAB ® ® 7 7 .xx .xx
Predstavitev Predstavitev kako uporabiti
kako uporabiti ….. …..
vin MPLAB MPLAB MPLAB MPLAB ® ® ® ® 7 7 7 7 .xx Layout .xx Layout .xx Layout .xx Layout
Status Bar Tool Bar
Workspace
Project Window
Output Window (tabs are added
as tools are enabled)
Buttons are added to the
Toolbar as features are enabled
vin Setup Information Setup Information MPLAB MPLAB ® ® IDE IDE MPLAB
MPLAB ® ® IDE IDE
Setup Information Setup Information
Workspace:
Contains setup information which includes:
– Selected device from menu
– Debug tool and/or programmer
– Open windows used and their location
– IDE configuration settings
Project:
Contains source files needed to build and test an application
Workspace:
Contains setup information which includes:
– Selected device from menu
– Debug tool and/or programmer
– Open windows used and their location
– IDE configuration settings
Project:
Contains source files needed to build and test
an application
vin MPLAB MPLAB MPLAB MPLAB ® ® ® ® IDE Windows IDE Windows IDE Windows IDE Windows
Windows available in a new workspace
Project
Output
Disassembly
Watch
Hardware Stack
Program memory
File Registers
EEPROM data
Special Function Registers
Windows available in a new workspace
Project
Output
Disassembly
Watch
Hardware Stack
Program memory
File Registers
EEPROM data
Special Function Registers
vin Window Descriptions Window Descriptions MPLAB MPLAB ® ® IDE IDE MPLAB
MPLAB ® ® IDE IDE
Window Descriptions Window Descriptions
Project
Project files within a project by file type:
– Source Files, Header Files, Object Files, Library Files & Linker Scripts
Output
Tabbed information about program output
Disassembly
Disassembled code is viewed
– Breakpoints can be set in code
Project
Project files within a project by file type:
– Source Files, Header Files, Object Files, Library Files & Linker Scripts
Output
Tabbed information about program output
Disassembly
Disassembled code is viewed
– Breakpoints can be set in code
vin Window Descriptions (cont.) Window Descriptions (cont.) MPLAB MPLAB ® ® IDE IDE MPLAB
MPLAB ® ® IDE IDE
Window Descriptions (cont.) Window Descriptions (cont.)
Watch
Program symbols can be monitored and displayed while program is running
Hardware stack
Stack data is displayed in 3 columns
– Top of Stack, Stack level & return address
Program memory
Opcodes are displayed 5 different ways
– Opcode Hex, Machine & Symbolic
Watch
Program symbols can be monitored and displayed while program is running
Hardware stack
Stack data is displayed in 3 columns
– Top of Stack, Stack level & return address
Program memory
Opcodes are displayed 5 different ways
– Opcode Hex, Machine & Symbolic
vin Window Descriptions (cont.) Window Descriptions (cont.) MPLAB MPLAB ® ® IDE IDE MPLAB
MPLAB ® ® IDE IDE
Window Descriptions (cont.) Window Descriptions (cont.)
File registers
General purpose registers are displayed
EEPROM Data
Data memory stored in EEPROM is displayed
Special Function Registers (SFR)
Symbolic names for SFRs are displayed
File registers
General purpose registers are displayed
EEPROM Data
Data memory stored in EEPROM is displayed
Special Function Registers (SFR)
Symbolic names for SFRs are displayed
vin MPLAB MPLAB ® ® v6.20 IDE v6.20 IDE
With Sample Code Loaded With Sample Code Loaded
MPLAB
MPLAB ® ® v6.20 IDE v6.20 IDE
With Sample Code Loaded With Sample Code Loaded
October 2002
October 2002 Microchip ConfidentialMicrochip Confidential Slide Slide 66
DSC Division Review
vin Creating a Project Creating a Project Creating a Project Creating a Project
Objectives
Using the Project Wizard in MPLAB ® IDE
Creating simple MPASM™ code written in MPLAB ® IDE (nop.asm)
Building code in MPLAB ® IDE
Introduce the Output Window and Program Memory Window
Selecting Build Options
Objectives
Using the Project Wizard in MPLAB ® IDE
Creating simple MPASM™ code written in MPLAB ® IDE (nop.asm)
Building code in MPLAB ® IDE
Introduce the Output Window and Program Memory Window
Selecting Build Options
vin Using Project Wizard Using Project Wizard MPLAB MPLAB ® ® IDE: IDE:
MPLAB
MPLAB ® ® IDE: IDE:
Using Project Wizard Using Project Wizard
Starting a new project
Select: Project-> Project Wizard Select: Next
Starting a new project
Select: Project-> Project Wizard
Select: Next
vin Project Wizard: Select Device Project Wizard: Select Device Project Wizard: Select Device Project Wizard: Select Device
Step 1: Select: PIC12F675 Select: Next
Step 1: Select: PIC12F675
Select: Next
vin Project Wizard: Select Toolsuite Project Wizard: Select Toolsuite Project Wizard: Select Toolsuite Project Wizard: Select Toolsuite
Step 2: Select: Microchip MPASM™ Toolsuite Select: Next
Step 2: Select: Microchip MPASM™ Toolsuite
Select: Next
vin Project Wizard: Select Name Project Wizard: Select Name Project Wizard: Select Name Project Wizard: Select Name
Step 3:
Project Directory:
C:\ProgramFiles\Microchip\PICkit1\Tutorials
Project Name: Workshop In A Box Select: Next
Step 3:
Project Directory:
C:\ProgramFiles\Microchip\PICkit1\Tutorials
Project Name: Workshop In A Box
Select: Next
vin Project Wizard: Summary Project Wizard: Summary Project Wizard: Summary Project Wizard: Summary
Step 4: Summary of new project parameters
Select: Finish
Step 4: Summary of new project parameters
Select: Finish
vin Project Wizard Completed Project Wizard Completed Project Wizard Completed Project Wizard Completed
Project name assigned
Next step is to make this project useful
Windows are added which display debugging capabilities of MPLAB IDE
Project name assigned
Next step is to make this project useful
Windows are added which display debugging
capabilities of MPLAB IDE
vin How to Open Windows in How to Open Windows in MPLAB
MPLAB ® ® IDE IDE
How to Open Windows in How to Open Windows in
MPLAB
MPLAB ® ® IDE IDE
MPLAB ® Workspace configured for use
Select View ->
Output View ->
Dissasembly View ->
Watch View ->
Hardware Stk View ->
Pgm Memory View ->
File Registers View ->
EEPROM View ->
SFRs
MPLAB ® Workspace configured for use
Select View ->
Output View ->
Dissasembly View ->
Watch View ->
Hardware Stk View ->
Pgm Memory View ->
File Registers View ->
EEPROM View ->
SFRs
vin MPLAB MPLAB ® ® Windows Open Windows Open With No Code Loaded With No Code Loaded MPLAB
MPLAB ® ® Windows Open Windows Open
With No Code Loaded
With No Code Loaded
vin Select a MPLAB Select a MPLAB ® ® SIM SIM Debug Tool
Debug Tool Select a MPLAB
Select a MPLAB ® ® SIM SIM Debug Tool
Debug Tool
Debugger -> Select Tool -> MPLAB SIM
MPLAB SIM chosen for this example
Debugger -> Select Tool -> MPLAB SIM
MPLAB SIM chosen for this example
vin Adding Symbols to Monitor in Adding Symbols to Monitor in Watch Window
Watch Window
Adding Symbols to Monitor in Adding Symbols to Monitor in
Watch Window Watch Window
View -> Watch
enter registers/variables to watch
click “Add SFR” or “Add Symbol”
View -> Watch
enter registers/variables to watch
click “Add SFR” or “Add Symbol”
vin Debugging using MPSIM™ Debugging using MPSIM™
Simulator Simulator
Debugging using MPSIM™
Debugging using MPSIM™
Simulator Simulator
The MPLAB ® IDE Program
The MPLAB ® IDE Program
Output Window Source Code
Project Window
Watch
Window
vin Setup Configuration Bits in Setup Configuration Bits in PICmicro
PICmicro ® ® MCUs MCUs
Setup Configuration Bits in Setup Configuration Bits in
PICmicro
PICmicro ® ® MCUs MCUs
PIC ® MCUs have Configuration Bits
Configuration bits are setup at program or debug time.
Set the Configuration Bits first, with Configure -> Configuration Bits,
then program the device.
Configuration Bits are Important!
Read the data sheet for your specific chip!
PIC ® MCUs have Configuration Bits
Configuration bits are setup at program or debug time.
Set the Configuration Bits first, with Configure -> Configuration Bits,
then program the device.
Configuration Bits are Important!
Read the data sheet
for your specific chip!
vin MPLAB MPLAB MPLAB MPLAB ® ® ® ® Project With Labels Project With Labels Project With Labels Project With Labels
Device Program Counter
W Register Status Register:
UC=1, LC=0
Checksum
Word Wrap
vin
PIC12F675 PIC12F675
Arhitektura Arhitektura
PIC12F675 PIC12F675
Arhitektura
Arhitektura
vin
PIC12F629/675 PIC12F629/675 Block Diagram Block Diagram
PIC12F629/675
PIC12F629/675
Block Diagram
Block Diagram
vin 8-Pin & 14-Pin Features 8-Pin & 14-Pin Features 8-Pin & 14-Pin Features 8-Pin & 14-Pin Features
PIC12F629/ PIC12F675
1.8K Bytes Flash Program (1Kw)
64 Bytes Data RAM
128 Bytes Data EEPROM
1 Comparator
1x8, 1x16 bit counters
Precision Internal OSC
Brown-Out Reset (BOR)
Watchdog Timer (WDT)
PDIP, SOIC, DFN
4 x 10-bit A/D (12F675)
PIC12F629/ PIC12F675
1.8K Bytes Flash Program (1Kw)
64 Bytes Data RAM
128 Bytes Data EEPROM
1 Comparator
1x8, 1x16 bit counters
Precision Internal OSC
Brown-Out Reset (BOR)
Watchdog Timer (WDT)
PDIP, SOIC, DFN
4 x 10-bit A/D (12F675)
PIC16F630/ PIC16F676
1.8K Bytes Flash Program (1Kw)
64 Bytes Data RAM
128 Bytes Data EEPROM
1 Comparator
1x8, 1x16 bit counters
Precision Internal OSC
Brown-Out Reset (BOR)
Watchdog Timer (WDT)
PDIP, SOIC, TSSOP
8 x 10-bit A/D (16F676)
PIC16F630/ PIC16F676
1.8K Bytes Flash Program (1Kw)
64 Bytes Data RAM
128 Bytes Data EEPROM
1 Comparator
1x8, 1x16 bit counters
Precision Internal OSC
Brown-Out Reset (BOR)
Watchdog Timer (WDT)
PDIP, SOIC, TSSOP
8 x 10-bit A/D (16F676)
vin PIC12F6xx <-> PIC16F630/676 PIC12F6xx <-> PIC16F630/676 PIC12F6xx <-> PIC16F630/676 PIC12F6xx <-> PIC16F630/676
PIC12F675 PIC12F675 PIC12F629
PIC12F629
PIC16F630
PIC16F630 PIC16F676 PIC16F676
8 x 10-bit A/D 8 x 10-bit A/D
4 x 10-bit A/D
4 x 10-bit A/D
vin 8-pin and 14-pin Compatibility 8-pin and 14-pin Compatibility 8-pin and 14-pin Compatibility 8-pin and 14-pin Compatibility
8 - P in 14 - P in
V
DDGP5/T1CKI/OSC1/CLKIN GP4/AN3/T1G/OSC2/CLKOUT VDDGP3/MCLR/V
PPV
SSGP0/AN0/CIN+/ICSPDAT GP1/AN1/CIN-/ICSPCLK GP2/AN2/T0CKI/INT/COUT RC0/AN4
RC1/AN5 RC2/AN6 RC3/AN7
RC4
RC5
vin 8-18 Pin Migration 8-18 Pin Migration 8-18 Pin Migration 8-18 Pin Migration
PIC12F675 PIC12F675
D ig ita l/ C om pa ra to r D ig ita l/ C om pa ra to r
PIC12F629 PIC12F629
PIC16F676 PIC16F676
PIC16F630 PIC16F630
PIC16F818/9 PIC16F818/9
PIC16F627/8 PIC16F627/8
PIC16C62xA PIC16C62xA
PIC16C71x PIC16C71x
PIC12C50xA PIC12C50xA
A /D A /D
PIC16C505 PIC16C505
8 Pin
8 Pin 14 Pin 14 Pin 18 Pin 18 Pin
Flash Flash
OTP OTP Enh Flash Enh Flash
PIC12C671/2
PIC12C671/2
vin Low Pin Count Low Pin Count Migration Paths Migration Paths
Low Pin Count Low Pin Count Migration Paths Migration Paths
PIC12F629 PIC12F675 PIC12F629 PIC12F675
PIC12C50x PIC12C67x PIC12C50x PIC12C67x
Flash, 10-bit A/D,
EEPROM, Comparat or, Better Intosc, 2V
Operation ,
x14 Core
PIC16F630 PIC16F676 PIC16F630 PIC16F676
PIC16C505 PIC16C505
Flash, A/D, EEPROM, Comparator , Better Intosc 2V
Operation, x14 Core More I/O,
More A/D channels
More I/O
Flash, 10-bit A/D, Better Intosc, more I/O, 2V
Operation, Comparator, EEPROM, x14 Core
Lower cost
PIC16F62x PIC16F81x PIC16F62x PIC16F81x
PIC16C62x PIC16C71x PIC16C62x PIC16C71x
Flash, 10- bit A/D, EEPROM, Better Intosc, 2V Operation , More Memory, USART More I/O and
memory,
Serial comms, CCP Lower cost,
more A/D
Flash, EEPROM, 10-bit A/D, Lower cost, Better Intosc, 2V
Operation Lower
cost
More I/O
Lower
cost
vin
Flash - Quality !!!!
Flash - Quality !!!! Flash - Quality !!!!
Flash - Quality !!!!
vin Strength - PEEC Flash Strength - PEEC Flash Program Memory
Program Memory
Strength - PEEC Flash Strength - PEEC Flash
Program Memory Program Memory
So What:
Best in the Industry Endurance Prove it:
Endurance - From Datasheet Spec
100,000 Erase/Write Cycles Program Memory
1,000,000 Erase/Write Cycles Data EEPROM
* How important is quality and reliability in the application?
So What:
Best in the Industry Endurance Prove it:
Endurance - From Datasheet Spec
100,000 Erase/Write Cycles Program Memory
1,000,000 Erase/Write Cycles Data EEPROM
* How important is quality and reliability in the
application?
vin Strength - Data EEPROM Strength - Data EEPROM Strength - Data EEPROM Strength - Data EEPROM
Provide Non-Volatile Storage for:
Calibration values
Serial numbers
After Production modification/customization
Storing custom settings during power down
Data EEPROM is Separate from Program Memory
More Read/Write cycles than Program Memory
Microcontroller can continue executing code while writing to Data EEPROM
Provide Non-Volatile Storage for:
Calibration values
Serial numbers
After Production modification/customization
Storing custom settings during power down
Data EEPROM is Separate from Program Memory
More Read/Write cycles than Program Memory
Microcontroller can continue executing code while
writing to Data EEPROM
vin
ADC ADC ADC ADC
10 Bit versus 8 Bit
10 Bit versus 8 Bit
vin Advantages of a Advantages of a Advantages of a Advantages of a 10-bit 10-bit 10-bit 10-bit A/D A/D A/D A/D
IN Adjust Amp 8-bit A/D Digital MCU
0V 5V
2V
0V 5V
0V 5V 3V 1V
10100100 00100101 10001110 10001001 00101001 11111010 To get 8-bit Resolution with an 8-bit
A/D, the signal must be full scale
vin Advantages of a Advantages of a Advantages of a Advantages of a 10-bit 10-bit 10-bit 10-bit A/D A/D A/D A/D
PIC12F675
IN
0V 5V 3V 1V
Signal can be measured directly
10-bits means 1024 steps
2V/5V*1024 = 409steps
more than 8-bit resolution
No more scaling required
No more adjustments required
Less components
Signal can be measured directly
10-bits means 1024 steps
2V/5V*1024 = 409steps
more than 8-bit resolution
No more scaling required
No more adjustments required
Less components
ADC
vin
When is a Comparator helpful ? When is a Comparator helpful ? When is a Comparator helpful ? When is a Comparator helpful ?
1.) Software ADC -> PIC16F630 2.) fast hardware shutdown 1.) Software ADC -> PIC16F630
2.) fast hardware shutdown
vin Strength - Comparator Strength - Comparator Strength - Comparator Strength - Comparator
Good General Purpose Comparator Standard on all products
Internal Voltage Divider (Vref) available
Up to 32 Software Programmable levels available
Eight different operating modes
Programmable input multiplexing
Output is externally available (Use as a stand- alone analog component)
Switched off if not used to save power
Good General Purpose Comparator Standard on all products
Internal Voltage Divider (Vref) available
Up to 32 Software Programmable levels available
Eight different operating modes
Programmable input multiplexing
Output is externally available (Use as a stand- alone analog component)
Switched off if not used to save power
vin Comparator Features: Comparator Features:
Eight Operating Modes Eight Operating Modes
Comparator Features:
Comparator Features:
Eight Operating Modes Eight Operating Modes
- +
CIN - CIN +
Cout
Default
Internal Out
External/Internal Out
- +
CIN - CIN +
Cout
- +
CIN - CIN +
Cout
External/Internal Out with Internal Reference
- +
CIN - CIN +
Cout Vref
HW-shutdown possible
vin Comparator Features: Comparator Features:
Eight Operating Modes (cont.) Eight Operating Modes (cont.)
Comparator Features:
Comparator Features:
Eight Operating Modes (cont.) Eight Operating Modes (cont.)
Off (Lowest Power)
Internal Out
with Internal Reference
Input Multiplexing with Internal Reference
Input Multiplexing with Internal Reference
- +
CIN - CIN +
Cout Vref
- +
CIN - CIN +
Cout
- +
CIN - CIN +
Cout Vref
CIS
- +
CIN - CIN +
Cout Vref
CIS
vin
Comparator uses for 10Bit SW-ADC
PIC12F6xx , PIC16F630, PIC16F/C62x
vin Temperature Measurement Temperature Measurement Circuit Using a Diode
Circuit Using a Diode
Temperature Measurement Temperature Measurement
Circuit Using a Diode Circuit Using a Diode
43k
~0.1mA
V
DD= 5V
Low Output Impedance
CMCON := 0000 0011 VRCON := 1110 1100
R
1= 24k
R
2=31.5k
R =196k
V
DD/ 2 V
DDR
2C
INTRA3
RA0 R
1PIC16F676 PIC16F676
+
PortA.3
CMCON.6 Comparator
V
DDRA2 R
3MCP601
Input Range 200mV to 800mV High Input
Impedance
vin
What is the wake-up time of a
What is the wake-up time of a
controller after SLEEP mode ?
controller after SLEEP mode ?
What is the wake-up time of a
What is the wake-up time of a
controller after SLEEP mode ?
controller after SLEEP mode ?
vin Why is a quick startup Why is a quick startup important?
important?
Why is a quick startup Why is a quick startup
important?
important?
1uA 1mA
Device wakes up (8 Tcycle-int. RC), tests a condition and go back to sleep
Idd
For battery applications:
Minimize ‘On’ time
Minimum sleep current A quick startup
time reduces
‘on’ time
Result:
Longer
battery life
vin
Simplify the Power Supply
Simplify the Power Supply Simplify the Power Supply
Simplify the Power Supply
vin Strength: Wide Operating Strength: Wide Operating Voltage
Voltage
Strength: Wide Operating Strength: Wide Operating
Voltage Voltage
So What:
Flexibility to select best available/low cost device to interface to PIC12F6xx
Does not require additional components to translate voltage levels so that different
components can interface So What:
Flexibility to select best available/low cost device to interface to PIC12F6xx
Does not require additional components to translate voltage levels so that different
components can interface
vin Wide Operating Voltage - Wide Operating Voltage - doesn’t need a LDO...
doesn’t need a LDO...
Wide Operating Voltage - Wide Operating Voltage -
doesn’t need a LDO...
doesn’t need a LDO...
Time Voltage
Wider operating voltage
means easier Power-supply Operating voltage range
with LDO
2,0/2,2V
2,0/2,2V
vin Strength - Packaging Strength - Packaging Strength - Packaging Strength - Packaging
8-Pin
SN package (150mil SOIC)
DFN (Flatter) package
14-Pin
12 I/O Pins
150 mil SOIC
TSSOP package available
8-Pin
SN package (150mil SOIC)
DFN (Flatter) package
14-Pin
12 I/O Pins
150 mil SOIC
TSSOP package available PI C1 6F
63 0 PI C1 6F 67 6 PI C1 2F 62 9
PI C1 2F 67 5
vin QFN Package Cross QFN Package Cross Section
Section
QFN Package Cross QFN Package Cross
Section Section
Mold Compound Mold Compound
Cu Leadframe Cu Leadframe
Gold Wire Gold Wire Die Die
Lands
Lands
vin Development Tool Support Development Tool Support Development Tool Support Development Tool Support
MPLAB ® Integrated Development Environment
Simulator, Assembler, Linker
Programming support
PRO MATE ® II programmer
PICSTART ® Plus programmer (low-cost)
PICKit 1 Flash Starterkit PICKit 1 Flash Starterkit
MPLAB ® In-Circuit Debugger (ICD 2)
MPLAB ® ICE 2000 Emulator
MPLAB ® Integrated Development Environment
Simulator, Assembler, Linker
Programming support
PRO MATE ® II programmer
PICSTART ® Plus programmer (low-cost)
PICKit 1 Flash Starterkit PICKit 1 Flash Starterkit
MPLAB ® In-Circuit Debugger (ICD 2)
MPLAB ® ICE 2000 Emulator
vin ICD for 8/14 Pin Devices ICD for 8/14 Pin Devices ICD for 8/14 Pin Devices ICD for 8/14 Pin Devices
Target Board ICD Device
(PIC12F675/ICD) ICD2 Header
(AC162050) ICD2 (DV164005,
DV164006,DV164007)
To PC
vin Summary Features Summary Features Summary Features Summary Features
Flash Program Memory
Real Data EE 2
Wide Operating Voltage 2.0-5.5V
10-bit resolution on the A/D (12F675/16F676 only)
Analog Comparator Module + programmable Vref
Precision Internal 4MHz Oscillator +-2%
Operating Speed up to 20MHz
In-Circuit Debug Capability
Packaging - DFN-S,TSSOP
Brown-out Reset
Flash Program Memory
Real Data EE 2
Wide Operating Voltage 2.0-5.5V
10-bit resolution on the A/D (12F675/16F676 only)
Analog Comparator Module + programmable Vref
Precision Internal 4MHz Oscillator +-2%
Operating Speed up to 20MHz
In-Circuit Debug Capability
Packaging - DFN-S,TSSOP
Brown-out Reset
vin Technical Literature Technical Literature Technical Literature Technical Literature
PIC12F629/675 Data Sheet - DS41190C
Programming Spec. - DS41173B
PIC16F630/676 Data Sheet DS40039C
PIC16F630/676 Programming Spec. DS41191B
Tips n’ Tricks Brochure
Please check Microchip’s Web Site for the
latest Versions of the Data Sheet and possible Errata-sheets
PIC12F629/675 Data Sheet - DS41190C
Programming Spec. - DS41173B
PIC16F630/676 Data Sheet DS40039C
PIC16F630/676 Programming Spec. DS41191B
Tips n’ Tricks Brochure
Please check Microchip’s Web Site for the
latest Versions of the Data Sheet and possible Errata-sheets
vin
Workshop Lessons Workshop Lessons
using using
PICkit
PICkit TM TM 1 1
Workshop Lessons Workshop Lessons
using using
PICkit
PICkit TM TM 1 1
vin Overview Overview Overview Overview
Lesson 1: Blinking LED 200ms
Lesson 2: read a button -> LED on/off
Lesson 3: Constant Main-loops
Lesson 4: SW-PWM standard via IRQ
Lesson 5: SW- PWM easy way
Lesson 1: Blinking LED 200ms
Lesson 2: read a button -> LED on/off
Lesson 3: Constant Main-loops
Lesson 4: SW-PWM standard via IRQ
Lesson 5: SW- PWM easy way
vin Lesson #1 Lesson #1 Lesson #1 Lesson #1
In Lesson #1 a very basic program is
downloaded to the PIC12F675, which drives LED D0 ON/OFF at a 200 millisecond rate.
The Flowchart for Lesson #1 shows the basic operation of the source code
The block diagram shows a typical circuit used to drive an LED.
– 2 different methods of driving an LED using an I/O port are shown
Source code description includes Assembler directives and initialization of PICmicro
In Lesson #1 a very basic program is
downloaded to the PIC12F675, which drives LED D0 ON/OFF at a 200 millisecond rate.
The Flowchart for Lesson #1 shows the basic operation of the source code
The block diagram shows a typical circuit used to drive an LED.
– 2 different methods of driving an LED using an I/O port are shown
Source code description includes Assembler
directives and initialization of PICmicro
vin Flowchart & LED Drive Circuit Flowchart & LED Drive Circuit Lesson #1 Lesson #1 Lesson #1
Lesson #1
Flowchart & LED Drive Circuit Flowchart & LED Drive Circuit
VCC
OUT1 OUT2
PIC12F675
LED1
LED2
LED OUT1 OUT2
LED1 ON LO X
LED1 OFF HI or Z X
LED2 ON X HI
LED2 OFF X LO or Z
vin Assembly Code Description Assembly Code Description Assembly Code Description Assembly Code Description
Assembler directives are used at the
beginning of the program to select additional library functions and set initial conditions.
#Include
– Assembler directive to load Libraries
_Config
– Assembler directive to assign the initial conditions of the microcontroller
#Define
– Defines variables and assigns initial values
Assembler directives are used at the
beginning of the program to select additional library functions and set initial conditions.
#Include
– Assembler directive to load Libraries
_Config
– Assembler directive to assign the initial conditions of the microcontroller
#Define
– Defines variables and assigns initial values
vin Lesson #1 Source Code Lesson #1 Source Code Assembler Directives Assembler Directives Lesson #1 Source Code Lesson #1 Source Code
Assembler Directives Assembler Directives
list p=12F675
#include <p12f675.inc>
__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF…...
#define DELAYCONSTANT .255
#define TRISIO_INIT b'11111110' ;GP0 - Output
#define LED GPIO,0
cblock 0x20
INNER
OUTER
endc
vin Assembly Code Description Assembly Code Description (continued)
(continued)
Assembly Code Description Assembly Code Description
(continued) (continued)
Microcontrollers require initialization after they come out of their Power On Reset (POR) condition.
Initialize function
– Located at the beginning of a program
– Memory, registers and I/O ports should be initialized to specific values for a more
robust design
Microcontrollers require initialization after they come out of their Power On Reset (POR) condition.
Initialize function
– Located at the beginning of a program
– Memory, registers and I/O ports should be initialized to specific values for a more
robust design
vin
vin Lesson #1 Source Code Lesson #1 Source Code Initialization of PICmicro Initialization of PICmicro Lesson #1 Source Code Lesson #1 Source Code Initialization of PICmicro Initialization of PICmicro
org 0x00 Initialize
banksel GPIO ;Bank 0 movlw .7
movwf CMCON ;Comparator Off, Pins Set
;For Digital clrf GPIO
banksel TRISIO ;Bank 1 movlw TRISIO_INIT
movwf TRISIO
clrf ANSEL ;Pins Set For Digital
banksel GPIO ;Bank 0
vin
vin
vin Assembly Code Description Assembly Code Description (continued)
(continued)
Assembly Code Description Assembly Code Description
(continued) (continued)
A main program is used to control the overall operation of any microcontroller.
MAIN function
– Usually located after the Initialize section
– Will call other subroutine functions for steps that are repeated throughout the operation
Delay
– Subroutine function with a programmable delay to control LED ON/OFF timing
A main program is used to control the overall operation of any microcontroller.
MAIN function
– Usually located after the Initialize section
– Will call other subroutine functions for steps that are repeated throughout the operation
Delay
– Subroutine function with a programmable
delay to control LED ON/OFF timing
vin Lesson #1 Source Code Lesson #1 Source Code Main Function
Main Function
Lesson #1 Source Code Lesson #1 Source Code
Main Function Main Function
Main
bsf LED ;Turn on LED
movlw DELAYCONSTANT
call Delay ;Delay
bcf LED ;Turn off LED
movlw DELAYCONSTANT ;Delay call Delay
goto Main ;Start All Over Again
vin Assembly Code Description Assembly Code Description (continued)
(continued)
Assembly Code Description Assembly Code Description
(continued) (continued)
A subroutine or function is used to support the Main function of a microcontroller.
Delay function
– This function is called by the Main function when a programmable delay is required
– The delay in this function is used to control the rate that the LED cycles ON and OFF
A subroutine or function is used to support the Main function of a microcontroller.
Delay function
– This function is called by the Main function when a programmable delay is required
– The delay in this function is used to control
the rate that the LED cycles ON and OFF
vin Lesson #1 Source Code Lesson #1 Source Code Delay Subroutine
Delay Subroutine
Lesson #1 Source Code Lesson #1 Source Code
Delay Subroutine Delay Subroutine
; Delay(W) - DelayTime = [ (1)+(2)+(2)+(W*768-W)+(W*3-
1)+(2)]* (OSC/4)cycles (This includes the movlw,call,and return)
; - Max Time When W=0xFF, [ 196356 Cycles * (OSC/4) ]
; - Must Declare INNER & OUTER AS GPR'S
;******************************************************
Delay
movwf OUTER clrf INNER D1 decfsz INNER,f
goto D1
D2 decfsz OUTER,f goto D1
return
vin Lesson #1 Lesson #1 Lesson #1 Lesson #1
Step 1: Create a project under MPLAB
Step 2: Enter the code , assemble
Step 3: Simulate it under MPLAB
Step 4: Begin communication with PICkit 1
Start->Programs->PICKit 1 FLASH Start Kit
Screenshots are shown on next slide
Step 1: Create a project under MPLAB
Step 2: Enter the code , assemble
Step 3: Simulate it under MPLAB
Step 4: Begin communication with PICkit 1
Start->Programs->PICKit 1 FLASH Start Kit
Screenshots are shown on next slide
vin It starts Here… It starts Here…
“Ready for launch...”
“Ready for launch...”
It starts Here…
It starts Here…
“Ready for launch...”
“Ready for launch...”
Emulate Program
Device
Simulate and Debug
Design Process
Edit & Build
Project
Management
vin
MPASM™
Assembler Language
Products
Low-cost Debugging
Emulation and Analyis
Device Programmers
Third Party Tools
MPLINK™
MPLIB™
MPLAB C17 MPLAB C18 MPLAB C30
MPLAB SIM Sofware Simulator
MPLAB ICD MPLAB ICD 2
MPLAB ICE 2000
MPLAB ICE 4000
PICSTART
®Plus
PRO MATE
®II
PRO MATE 3
MPLAB ®
Built-in Editor
Project Manager
Source Level Debugger
C Compilers IAR Hi-Tech
CCS
Real-time Operating Systems
CMX, Vector, Realogy
Libraried Routines Live Devices, CMX,
Momentum Data Systems