TB088

TB088
PIC16F639 Microcontroller Overview
Author:
The four LF I/O pins (LCX, LCY, LCZ, LCCOM) are used
to detect low-frequency input signals and to transmit
data by modulating the input voltage. External LC
resonant circuits need to be connected to the LF I/O
pins. The device’s LF analog channels are optimized for
125 kHz input signal with an input sensitivity of about
1 mVPP, which allows a bidirectional communication
distance of up to a few meters. See Table 1 for more
feature details.
Youbok Lee, Ph.D.
Microchip Technology Inc.
INTRODUCTION
The PIC16F639 is a suitable microcontroller for
bidirectional communications, remote passive keyless
entry and low-frequency sensing applications. The
device includes a PIC16F636 microcontroller and a
three channel Low-Frequency (LF) front-end device in
a single 20-pin SSOP package. These two devices are
internally connected via a modified SPI interface.
The device also has 2K words of Flash program memory,
two comparators, a KEELOQ® encryption/decryption
peripheral, user-selectable internal oscillator frequency
and three-channel analog front-end for low-frequency
detection and LF talk-back. The three-channel analog
front-end allows orthogonally positioned antenna
connections to detect input signals from x, y and z
directions.
The CS, SCLK/ALERT and LFDATA/RSSI/CCLK/SDIO
pads of the analog front-end device are internally wire
bonded to RC1, RC2 and RC3 pads of the PIC16F639
microcontroller, respectively.
For a low-power battery operation, the device has
various low-power modes (Sleep, Standby, Active) and
is optimized to consume very low currents. The device
can also be operated in battery backup and batteryless
modes using only a few external components. An
example of the circuit is shown in the “PIC12F635/
PIC16F636/639 Data Sheet” (DS41232).
The PIC16F639 has twelve digital I/O pins and four LF
I/O pins. The digital I/O pins are used in the same way
as on the PIC16F636 device. Figure 1 shows the pin
diagram of the PIC16F639.
PIC16F639 PIN DIAGRAM
VDD
1
20
VSS
RA5/T1CKI/OSC1/CLKIN
2
19
RA0/C1IN+/ICSPDAT/ULPWU
RA4/T1G/OSC2/CLKOUT
3
18
RA1/C1IN-/VREF/ICSPCLK
RA3/MCLR/VPP
4
17
RA2/T0CKI/INT/C1OUT
16
RC0/C2IN+
15
RC1/C2IN-/CS
14
RC2/SCLK/ALERT
PIC16F639
FIGURE 1:
RC5
5
RC4/C2OUT
6
RC3/LFDATA/RSSI/CCLK/SDIO
7
VDDT
8
13
VSST
LCZ
9
12
LCCOM
LCY
10
11
LCX
Analog section
© 2005 Microchip Technology Inc.
DS91088B-page 1
TB088
TABLE 1:
DEVICE FEATURES
Parameters/Features
Description
Supply Voltage
2.0-3.6V
LF Input Sensitivity
1-6 mVPP
LF Input Wake-up Pattern
Programmable: High and low pulse durations (8 different timing choices)
Eight Configuration AFE Registers
Programmable via a modified SPI, except STATUS register (read-only)
Selectable AFE Output
Demodulated Data, RSSI Current, Carrier Clock
LF Input Channel Selection
Each channel can be individually enabled or disabled
LF Input Modulation Depth Selection
8%, 14%, 33%, 60%
Antenna Tuning Capacitance
Programmable up to 63 pF (1 pF/step) for each channel
Input Sensitivity Reductions
Programmable up to 30 dB (2 dB/step) for each channel
Sleep Current
200 nA typical for both MCU and analog front-end
Standby Current
1 channel enabled: 2 μA, VDD = 3.0V and MCU = Sleep condition
2 channels enabled: 3 μA, VDD = 3.0V and MCU = Sleep condition
3 channels enabled: 4 μA, VDD = 3.0V and MCU = Sleep condition
Active Current
MCU: 500 μA @ VDD = 3.0V and FOSC = 4 MHz
AFE: 13 μA (3 channels enabled)
Base Station Data Rate to Transponder 10 Kbps (max) with NRZ Format
MCU Memory
Program Flash Memory: 2048 Words
EEPROM: 256 Bytes
SRAM: 128 Bytes
MCU I/O Pins
12 I/O, 3 I/O are shared with AFE
Selectable MCU Internal Clock
31 kHz, 125 kHz, 250 kHz, 500 kHz, 1 MHz, 2 MHz, 4 MHz, 8 MHz
Encryption/Decryption
KEELOQ® hardware peripheral in microcontroller
Interrupt-on-Change of PORTA (IOCA) Each of the PORTA pins is individually configured as an interrupt-on-change
pin
Programmable Low-Voltage Detector
(PLVD)
This feature can be used to detect VDD (battery voltage) level
Two Analog Comparators
These comparators are general purpose. One can be used when
implementing firmware-based ADC for RSSI output.
Two Internal Timers (Timer0, Timer1)
These timers are useful for measuring pulse timing. The Timer1 can also be
used for firmware-based ADC implementation.
Operating Temperature
-40°C to +85°C
Note:
Refer to the “PIC12F635/PIC16F636/639 Data Sheet” (DS41232) for more detail.
DS91088B-page 2
© 2005 Microchip Technology Inc.
TB088
LF Signal Detection and Detector Output
To detect the LF signal, or to send a response with LF,
the device needs external LC parallel resonant circuits
at the LF input pins. The LC resonant antenna
becomes most sensitive when the antenna is tuned
precisely to the frequency of interest (carrier frequency
of the base station). Each LF input channel has dynamical programmable tuning capacitance up to 63 pF
(1 pF per step) to compensate for the discrepancy in
frequency tuning due to the variation of external
component tolerance of the LC resonant circuits.
The analog front-end functions are controlled by its
eight Configuration registers, which can be dynamically
reprogrammed by the microcontroller firmware based
on real-time signal conditions and applications. The
analog front-end outputs demodulated data, a carrier
clock or a received signal strength indicator (RSSI
current) by controlling the output selection bit of the
internal Configuration register.
When the device detects valid input signals, it sends a
message to the base station via an external UHF transmitter or the internal LF talk-back modulator of each
channel. The KEELOQ® cryptographic hardware peripheral of the microcontroller allows it to transmit and
receive encrypted data for secure data communications.
The dynamically reconfigurable output enable (wake-up)
filter allows the microcontroller to wake-up only after a
predefined signal has been received, thus keeping
current consumption to a minimum, but ignoring all other
unwanted signals. The output enable (wake-up) filter
consists of high and low durations of the pulse in the
header of the input data stream. The user has the choice
of up to 8 different output enable (wake-up) filter
settings.
When the RSSI output is selected, the device outputs
analog current proportional to the input signal strength.
The RSSI feature can be effectively used for tuning the
LC resonant antenna and distance measurement from
the signal source. The digitized value of the RSSI can
be obtained by implementing a firmware-based ADC.
The digitized value of the RSSI output can be transmitted to the base station for further information. For
example, on the LC resonant antenna tuning, the
device selects its internal resonant capacitor while
monitoring the RSSI value until the highest RSSI value
is found. This antenna tuning can be accomplished by
firmware, which saves the system manufacturer’s labor
intense time for the manual LC tuning during the
assembly process.
The device can be configured to detect amplitudemodulated input signals with various modulation depths
(8%, 14%, 33% and 60%). For example, if the device is
configured to 8% minimum modulation depth, it can
demodulate the input signal in a noisy environment more
efficiently than with a higher modulation depth setting. In
addition, it can also detect the signal when it is very close
to the base station antenna, where the modulation depth
of the amplitude-modulated signal becomes weaker due
to a long decay time of strong RF signals.
A significant advantage that the PIC16F639 device
has, when compared to similar devices in the marketplace, is that it can demodulate weakly modulated input
signals.
Figure 2 shows an example of the device’s demodulated
output for an input signal with 2 mVPP amplitude and
about 14% modulation depth. In this example, the
device’s minimum modulation depth setting is 8% and
the output enable filter (wake-up filter) is enabled.
The output appears right after the output enable filter’s
waveform. For more information on the output enable
filter and minimum modulation depth settings, see the
“PIC12F635/PIC16F636/639 Data Sheet” (DS41232).
© 2005 Microchip Technology Inc.
DS91088B-page 3
TB088
FIGURE 2:
EXAMPLE OF DEVICE’S DEMODULATED OUTPUT VS. INPUT
Demodulated
Output
Input at LC Pin
CONCLUSION
MCU Firmware Development Tools
The PIC16F639 is an microcontroller-based, lowfrequency transponder. The device is easy to use and
has a high degree of flexibility for LF applications. With
its high input sensitivity (3 mVPP), ability to detect input
signal with weak modulation depth (down to 8%), builtin KEELOQ® encryption/decryption peripheral and firmware-based feature control, the device can be used in
various applications, including a low-cost Passive
Keyless Entry (PKE) transponder, a magnetic field
sensor in tire pressure monitoring systems, long range
access control applications and many more.
Compatible with the following PIC16F639 development
tools:
• MPLAB® Integrated Development Environment
Software (IDE)
• MPLAB® ICE 2000 High-Performance Universal
In-Circuit Emulator
• MPLAB® PM3 Device Programmer
• PICSTART® Plus Development Programmer
• MPLAB® ICD 2 In-Circuit Debugger
• PICkit™ 1 Flash Starter Kit
REFERENCES
1.
2.
DS91088B-page 4
“PIC12F635/PIC16F636/639
Data
Sheet”
(DS41232); Microchip Technology Inc.
AN959, “Using the PIC16F639 MCU for Smart
Wireless Applications” (DS00959); Microchip
Technology Inc.
© 2005 Microchip Technology Inc.
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 committed to continuously improving the code protection features of 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.
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’s products as critical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any Microchip intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, Accuron,
dsPIC, KEELOQ, microID, MPLAB, PIC, PICmicro,
PICSTART, PRO MATE, PowerSmart, rfPIC, and
SmartShunt are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Migratable Memory, MXDEV, MXLAB,
PICMASTER, 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, dsPICDEM,
dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR,
FanSense, FlexROM, fuzzyLAB, In-Circuit Serial
Programming, ICSP, ICEPIC, Linear Active Thermistor,
MPASM, MPLIB, MPLINK, MPSIM, PICkit, PICDEM,
PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo,
PowerMate, PowerTool, rfLAB, rfPICDEM, Select Mode,
Smart Serial, SmartTel, Total Endurance and WiperLock 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.
© 2005, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received ISO/TS-16949:2002 quality system certification for
its worldwide headquarters, design and wafer fabrication facilities in
Chandler and Tempe, Arizona and Mountain View, California in
October 2003. The Company’s quality system processes and
procedures are for its PICmicro® 8-bit MCUs, 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.
© 2005 Microchip Technology Inc.
DS91088B-page 5
WORLDWIDE SALES AND SERVICE
AMERICAS
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://support.microchip.com
Web Address:
www.microchip.com
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
India - Bangalore
Tel: 91-80-2229-0061
Fax: 91-80-2229-0062
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
India - New Delhi
Tel: 91-11-5160-8631
Fax: 91-11-5160-8632
Austria - Wels
Tel: 43-7242-2244-399
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
China - Chengdu
Tel: 86-28-8676-6200
Fax: 86-28-8676-6599
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
China - Fuzhou
Tel: 86-591-8750-3506
Fax: 86-591-8750-3521
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
Korea - Gumi
Tel: 82-54-473-4301
Fax: 82-54-473-4302
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Atlanta
Alpharetta, GA
Tel: 770-640-0034
Fax: 770-640-0307
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Kokomo
Kokomo, IN
Tel: 765-864-8360
Fax: 765-864-8387
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
San Jose
Mountain View, CA
Tel: 650-215-1444
Fax: 650-961-0286
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
China - Shunde
Tel: 86-757-2839-5507
Fax: 86-757-2839-5571
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xian
Tel: 86-29-8833-7250
Fax: 86-29-8833-7256
Malaysia - Penang
Tel: 60-4-646-8870
Fax: 60-4-646-5086
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-572-9526
Fax: 886-3-572-6459
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
10/31/05
DS91088B-page 6
© 2005 Microchip Technology Inc.