Instrukcja obsługi Microchip PIC24FJ64GA202

Microchip Niesklasyfikowane PIC24FJ64GA202

Przeczytaj poniżej 📖 instrukcję obsługi w języku polskim dla Microchip PIC24FJ64GA202 (137 stron) w kategorii Niesklasyfikowane. Ta instrukcja była pomocna dla 19 osób i została oceniona przez 2 użytkowników na średnio 4.5 gwiazdek

Strona 1/137
© 2009 Microchip Technology Inc. DS01146B
Compiled Tips ‘N Tricks Guide
DS01146B-page ii © 2009 Microchip Technology Inc.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEE EELOQ, K LOQ logo, MPLAB, PIC, PICmicro,
PICSTART, rfPIC, SmartShunt and UNI/O are registered
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
FilterLab, Hampshire, Linear Active Thermistor, MXDEV,
MXLAB, SEEVAL, SmartSensor and The Embedded Control
Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard,
dsPICDEM, dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, In-Circuit Serial
Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, nanoWatt XLP,
PICkit, PICDEM, PICDEM.net, PICtail, PIC32 logo, PowerCal,
PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select
Mode, Total Endurance, TSHARC, WiperLock and ZENA are
trademarks of Microchip Technology Incorporated in the
U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2009, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Note the following details of the code protection feature on Microchip devices:
Microchip products meet the specification contained in their particular Microchip Data Sheet.
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
Microchip is willing to work with the customer who is concerned about the integrity of their code.
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are co ng the code protection features ofmmitted to continuously improvi our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Microchip received ISO/TS-16949:2002 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ ®
code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
© 2009 Microchip Technology Inc. Page i-DS01146B
8-pin Flash PIC
®
Microcontroller Tips ‘n Tricks
Tips ‘n Tricks
TABLE OF CONTENTS
8-pin Flash PIC® Microcontrollers
Tips ‘n Tricks
TIPS ‘N TRICKS WITH HARDWARE
TIP #1: Dual Speed RC Oscillator .......................... 1-2
TIP #2: Input/Output Multiplexing............................ 1-2
TIP #3: Read Three States From One Pin .............. 1-3
TIP #4: Reading DIP Switches ................................ 1-3
TIP #5: Scanning Many Keys With One Input......... 1-4
TIP #6: Scanning Many Keys and Wake-up
From Sleep ................................................. 1-4
TIP #7: 8x8 Keyboard with 1 Input .......................... 1-5
TIP #8: One Pin Power/Data................................... 1-5
TIP #9: Decode Keys and ID Settings .................... 1-6
TIP #10: Generating High Voltages .......................... 1-6
TIP #11: V Self Starting Circuit ............................. 1-7dd
TIP #12: Using PIC
®
MCU A/D For Smart
Current Limiter............................................ 1-7
TIP #13: Reading A Sensor With Higher Accuracy ... 1-8
TIP #13.1: Reading A Sensor With Higher
Accuracy – RC Timing Method ................... 1-8
TIP #13.2: Reading A Sensor With Higher
Accuracy – Charge Balancing Method .......1-10
TIP #13.3: Reading A Sensor With Higher
AccuracyA/D Method ..............................1-11
TIP #14: Delta Sigma Converter ...............................1-11
TIPS ‘N TRICKS WITH SOFTWARE
TIP #15: Delay Techniques .......................................1-12
TIP #16: Optimizing Destinations..............................1-13
TIP #17: Conditional Bit Set/Clear ............................1-13
TIP #18: Swap File Register with W .........................1-14
TIP #19: Bit Shifting Using Carry Bit .........................1-14
PIC® Microcontroller Low Power
Tips ‘n Tricks
GENERAL LOW POWER TIPS ‘N TRICKS
TIP #1 Switching Off External Circuits/
Duty Cycle .................................................. 2-2
TIP #2 Power Budgeting ........................................ 2-3
TIP #3 Conguring Port Pins ................................. 2-4
TIP #4 Use High-Value Pull-Up Resistors .............. 2-4
TIP #5 Reduce Operating Voltage ......................... 2-4
TIP #6 Use an External Source for
CPU Core Voltage ...................................... 2-5
TIP #7 Battery Backup for PIC MCUs ................... 2-6
DYNAMIC OPERATION TIPS ‘N TRICKS
TIP #8 Enhanced PIC16 Mid-Range Core ............. 2-6
TIP #9 Two-Speed Start-Up ................................... 2-7
TIP #10 Clock Switching .......................................... 2-7
TIP #11 Use Internal RC Oscillators ........................ 2-7
TIP #12 Internal Oscillator Calibration ..................... 2-8
TIP #13 Idle and Doze Modes ................................. 2-8
TIP #14 Use and Idle Mode .............................. 2-9NOP
TIP #15 Peripheral Module Disable
(PMD) Bits .................................................. 2-9
STATIC POWER REDUCTION TIPS ‘N TRICKS
TIP #16 Deep Sleep Mode.......................................2-10
TIP #17 Extended WDT and Deep
Sleep WDT .................................................2-10
TIP #18 Low Power Timer1 Oscillator and RTCC ....2-10
TIP #19 Low Power Timer1 Oscillator Layout ..........2-11
TIP #20 Use LVD to Detect Low Battery ..................2-11
TIP #21 Use Peripheral FIFO and DMA...................2-11
TIP #22 Ultra Low-Power
Wake-Up Peripheral ...................................2-12
PIC® Microcontroller CCP and ECCP
Tips ‘n Tricks
CAPTURE TIPS ‘N TRICKS
TIP #1: Measuring the Period of a Square Wave ... 3-3
TIP #2: Measuring the Period of a
Square Wave with Averaging ..................... 3-3
TIP #3: Measuring Pulse Width .............................. 3-4
TIP #4: Measuring Duty Cycle ................................ 3-4
TIP #5: Measuring RPM Using an Encoder ............ 3-5
TIP #6: Measuring the Period of an Analog Signal 3-6 .
COMPARE TIPS ‘N TRICKS
TIP #7: Periodic Interrupts ...................................... 3-8
TIP #8: Modulation Formats.................................... 3-9
TIP #9: Generating the Time Tick for a RTOS ........3-10
TIP #10: 16-Bit Resolution PWM ..............................3-10
TIP #11: Sequential ADC Reader .............................3-11
TIP #12: Repetitive Phase Shifted Sampling ............3-12
PWM TIPS ‘N TRICKS
TIP #13: Deciding on PWM Frequency.....................3-14
TIP #14: Unidirectional Brushed DC
Motor Control Using CCP ...........................3-14
TIP #15: Bidirectional Brushed DC
Motor Control Using ECCP ........................3-15
TIP #16: Generating an Analog Output .....................3-16
TIP #17: Boost Power Supply ...................................3-17
TIP #18: Varying LED Intensity .................................3-18
TIP #19: Generating X-10 Carrier Frequency ...........3-18
COMBINATION CAPTURE AND COMPARE TIPS
TIP #20: RS-232 Auto-baud ......................................3-19
TIP #21: Dual-Slope Analog-to-Digital Converter .....3-21
© 2009 Microchip Technology Inc.Page ii-DS01146B
Tips ‘n Tricks Table of Contents
PIC® Microcontroller Comparator
Tips ‘n Tricks
TIP #1: Low Battery Detection ................................ 4-2
TIP #2: Faster Code for Detecting Change............. 4-3
TIP #3: Hysteresis................................................... 4-4
TIP #4: Pulse Width Measurement ......................... 4-5
TIP #5: Window Comparison .................................. 4-6
TIP #6: Data Slicer .................................................. 4-7
TIP #7: One-Shot .................................................... 4-8
TIP #8: Multi-Vibrator (Square Wave Output) ......... 4-9
TIP #9: Multi-Vibrator (Ramp Wave Output) ...........4-10
TIP #10: Capacitive Voltage Doubler ........................4-11
TIP #11: PWM Generator .........................................4-12
TIP #12: Making an Op Amp Out of a Comparator ...4-13
TIP #13: PWM High-Current Driver ..........................4-14
TIP #14: Delta-Sigma ADC .......................................4-15
TIP #15: Level Shifter ...............................................4-16
TIP #16: Logic: Inverter.............................................4-16
TIP #17: Logic: AND/NAND Gate .............................4-17
TIP #18: Logic: OR/NOR Gate..................................4-18
TIP #19: Logic: XOR/XNOR Gate .............................4-19
TIP #20: Logic: Set/Reset Flip Flop ..........................4-20
PIC® Microcontroller DC Motor Control
Tips ‘n Tricks
TIP #1: Brushed DC Motor Drive Circuits ............... 5-2
TIP #2: Brushless DC Motor Drive Circuits ............. 5-3
TIP #3: Stepper Motor Drive Circuits ...................... 5-4
TIP #4: Drive Software ............................................ 5-6
TIP #5: Writing a PWM Value to the CCP
Registers with a Mid-Range PIC
®
MCU ..... 5-7
TIP #6: Current Sensing ......................................... 5-8
TIP #7: Position/Speed Sensing ............................. 5-9
Application Note References .........................................5-11
Motor Control Development Tools .................................5-11
LCD PIC® Microcontroller Tips ‘n Tricks
TIP #1: Typical Ordering Considerations and
Procedures for Custom Liquid Displays ..... 6-2
TIP #2: LCD PIC
®
MCU Segment/Pixel Table ......... 6-2
TIP #3: Resistor Ladder for Low Current ................ 6-3
TIP #4: Contrast Control with a Buck Regulator ..... 6-5
TIP #5: Contrast Control Using a Boost
Regulator .................................................... 6-5
TIP #6: Software Controlled Contrast with
PWM for LCD Contrast Control .................. 6-6
TIP #7: Driving Common Backlights ....................... 6-7
TIP #8: In-Circuit Debug (ICD) ................................ 6-8
TIP #9: LCD in Sleep Mode .................................... 6-8
TIP #10: How to Update LCD Data
Through Firmware ...................................... 6-9
TIP #11: Blinking LCD............................................... 6-9
TIP #12: 4 x 4 Keypad Interface that Conserves
Pins for LCD Segment Drivers ...................6-10
Application Note References .........................................6-11
Intelligent Power Supply Design
Tips ‘n Tricks
TIP #1: Soft-Start Using a PIC10F200 .................... 7-2
TIP #2: A Start-Up Sequencer ................................ 7-3
TIP #3: A Tracking and Proportional
Soft-Start of Two Power Supplies ............... 7-4
TIP #4: Creating a Dithered PWM Clock ................ 7-5
TIP #5: Using a PIC
®
Microcontroller as a Clock
Source for a SMPS PWM Generator.......... 7-6
TIP #6: Current Limiting Using the MCP1630 ......... 7-7
TIP #7: Using a PIC
®
Microcontroller for
Power Factor Correction ............................ 7-8
TIP #8: Transformerless Power Supplies ............... 7-9
TIP #9: An IR Remote Control Actuated AC
Switch for Linear Power Supply Designs ...7-10
TIP #10: Driving High Side FETs ..............................7-11
TIP #11: Generating a Reference Voltage with a
PWM Output ...............................................7-12
TIP #12: Using Auto-Shutdown CCP ........................7-13
TIP #13: Generating a Two-Phase Control Signal ....7-14
TIP #14: Brushless DC Fan Speed Control ..............7-15
TIP #15: High Current Delta-Sigma Based Current
Measurement Using a Slotted Ferrite
and Hall Effect Device ................................7-16
TIP #16: Implementing a PID Feedback Control
in a PIC12F683-Based SMPS Design........7-17
TIP #17: An Error Detection and Restart Controller..7-18
TIP #18: Data-Indexed Software State Machine.......7-19
TIP #19: Execution Indexed Software
State Machine ............................................7-20
TIP #20: Compensating Sensors Digitally ................7-21
TIP #21: Using Output Voltage Monitoring to
Create a Self-Calibration Function .............7-22
3V Tips ‘n Tricks
TIP #1: Powering 3.3V Systems From 5V
Using an LDO Regulator ............................ 8-3
TIP #2: Low-Cost Alternative Power System
Using a Zener Diode .................................. 8-4
TIP #3: Lower Cost Alternative Power System
Using 3 Rectier Diodes ............................. 8-4
TIP #4: Powering 3.3V Systems From 5V
Using Switching Regulators ....................... 8-5
TIP #5: 3.3V → 5V Direct Connect ......................... 8-6
TIP #6: 3.3V → 5V Using a MOSFET Translator .... 8-6
TIP #7: 3.3V → 5V Using A Diode Offset ................ 8-7
TIP #8: 3.3V → 5V Using A Voltage Comparator .... 8-8
TIP #9: 5V → 3.3V Direct Connect ......................... 8-9
TIP #10: 5V → 3.3V With Diode Clamp .................... 8-9
TIP #11: 5V → 3.3V Active Clamp ............................8-10
TIP #12: 5V → 3.3V Resistor Divider........................8-10
TIP #13: 3.3V → 5V Level Translators......................8-12
TIP #14: 3.3V → 5V Analog Gain Block....................8-13
TIP #15: 3.3V → 5V Analog Offset Block ..................8-13
TIP #16: 5V → 3.3V Active Analog Attenuator ..........8-14
TIP #17: 5V → 3V Analog Limiter .............................8-15
TIP #18: Driving Bipolar Transistors .........................8-16
TIP #19: Driving N-Channel MOSFET Transistors ...8-18
© 2009 Microchip Technology Inc. DS01146B-Page 1-1
8-pin Flash PIC
®
Microcontroller Tips ‘n Tricks
CHAPTER 1
8-Pin Flash PIC® Microcontrollers
Tips ‘n Tricks
Table Of Contents
TIPS ‘N TRICKS WITH HARDWARE
TIP #1: Dual Speed RC Oscillator ................ 1-2
TIP #2: Input/Output Multiplexing .................. 1-2
TIP #3: Read Three States From One Pin .... 1-3
TIP #4: Reading DIP Switches ...................... 1-3
TIP #5: Scanning Many Keys With
One Input .......................................... 1-4
TIP #6: Scanning Many Keys and Wake-up
From Sleep ....................................... 1-4
TIP #7: 8x8 Keyboard with 1 Input ................ 1-5
TIP #8: One Pin Power/Data ......................... 1-5
TIP #9: Decode Keys and ID Settings .......... 1-6
TIP #10: Generating High Voltages ................ 1-6
TIP #11: V Self Starting Circuit.................... 1-7dd
TIP #12: Using PIC® MCU A/D For Smart
Current Limiter .................................. 1-7
TIP #13: Reading A Sensor With Higher
Accuracy ........................................... 1-8
TIP #13.1: Reading A Sensor With Higher
Accuracy – RC Timing Method ......... 1-8
TIP #13.2: Reading A Sensor With Higher
Accuracy – Charge Balancing
Method ............................................. 1-10
TIP #13.3: Reading A Sensor With Higher
Accuracy – A/D Method .................... 1-11
TIP #14: Delta Sigma Converter ..................... 1-11
TIPS ‘N TRICKS WITH SOFTWARE
TIP #15: Delay Techniques ............................. 1-12
TIP #16: Optimizing Destinations .................... 1-13
TIP #17: Conditional Bit Set/Clear .................. 1-13
TIP #18: Swap File Register with W ............... 1-14
TIP #19: Bit Shifting Using Carry Bit ............... 1-14
TIPS ‘N TRICKS INTRODUCTION
Microchip continues to provide innovative
products that are smaller, faster, easier to
use and more reliable. The 8-pin Flash PIC®
microcontrollers (MCU) are used in an wide
range of everyday products, from toothbrushes,
hair dryers and rice cookers to industrial,
automotive and medical products.
The PIC12F629/675 MCUs merge all the
advantages of the PIC MCU architecture and
the exibility of Flash program memory into
an 8-pin package. They provide the features
and intelligence not previously available due
to cost and board space limitations. Features
include a 14-bit instruction set, small footprint
package, a wide operating voltage of 2.0 to
5.5 volts, an internal programmable 4 MHz
oscillator, on-board EEPROM data memory,
on-chip voltage reference and up to 4 channels
of 10-bit A/D. The exibility of Flash and an
excellent development tool suite, including
a low-cost In-Circuit Debugger, In-Circuit
Serial Programming™ and MPLAB® ICE 2000
emulation, make these devices ideal for just
about any embedded control application.
TIPS ‘N TRICKS WITH HARDWARE
The following series of Tips ’n Tricks can be
applied to a variety of applications to help make
the most of the 8-pin dynamics.
© 2009 Microchip Technology Inc.Page 1-2 DS01146B
8-pin Flash PIC
®
Microcontroller Tips ‘n Tricks
TIP #1 Dual Speed RC Oscillator
Figure 1-1
PIC12F6XX
OSC1
GP0
+5V
R2
R1
C
1. After reset I/O pin is High-Z
2. Output ‘1’ on I/O pin
3. R1, R2 and C determine OSC frequency
4. Also works with additional capacitors
Frequency of PIC MCU in external RC oscillator
mode depends on resistance and capacitance
on OSC1 pin. Resistance is changed by the
output voltage on GP0. GP0 output ‘1’ puts R2
in parallel with R1 reduces OSC1 resistance
and increases OSC1 frequency. GP0 as
an input increases the OSC1 resistance
by minimizing current ow through R2, and
decreases frequency and power consumption.
Summary:
GP0 = Input: Slow speed for low current
GP0 = Output high: High speed for fast
processing
TIP #2 Input/Output Multiplexing
Individual diodes and some combination of
diodes can be enabled by driving I/Os high and
low or switching to inputs (Z). The number of
diodes (D) that can be controlled depends on
the number of I/Os (GP) used.
The equation is: D = GP x (GP - 1).
Example 2-1: Six LEDs on Three I/O Pins
GPx LEDs
0 1 2
0 0 0
0 1 Z
1 0 Z
Z 0 1
Z 1 0
0 Z 1
1 Z 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
1 2 3 4 5 6
0 0 0 0 0 0
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
0 0 1 0 1 0
1 0 0 1 0 0
1 0 0 0 1 0
0 1 0 0 0 1
0 1 1 0 0 0
0 0 0 1 0 1
0 0 0 0 0 0
Figure 2-1
PIC12F6XX
1 2 5
4
3
6
GP0
GP1
GP2


Specyfikacje produktu

Marka: Microchip
Kategoria: Niesklasyfikowane
Model: PIC24FJ64GA202

Potrzebujesz pomocy?

Jeśli potrzebujesz pomocy z Microchip PIC24FJ64GA202, zadaj pytanie poniżej, a inni użytkownicy Ci odpowiedzą




Instrukcje Niesklasyfikowane Microchip

Instrukcje Niesklasyfikowane

Najnowsze instrukcje dla Niesklasyfikowane