AN959

AN959
Using the PIC16F639 MCU for Smart Wireless Applications
Author:
Youbok Lee, Ph.D.
Microchip Technology Inc.
INTRODUCTION
The PIC16F639 is a suitable microcontroller for bidirectional communications 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 SPI™
interface pads.
The analog front-end section is optimized to detect
125 kHz low frequency (LF) signal. For the LF signal
detection, it needs external LC resonant circuits. The
device can detect amplitude-modulated 125 kHz input
signals with a typical input sensitivity of 3 mVPP. This
high input sensitivity allows for extended low-frequency
detection ranges in applications.
The device can transmit data by an internal LF talkback modulator for a proximity range communication or
via an external UHF resonator for a long range communication. The device can transmit and receive secured
data based on the built-in KEELOQ® cryptographic
hardware peripheral.
A bidirectional communication range of approximately
2 meters can be achieved with an appropriate base
station unit.
The device has three low-frequency input channels.
Each channel has its own external antenna connection
pins. Therefore, three orthogonally positioned
antennas can be connected to the device to detect the
input signals from x, y and z directions. This will greatly
reduce the antenna orientation problems in wireless
transponder applications.
Each low-frequency input channel has programmable
tuning capacitances up to 63 pF (1 pF per step) for a
fine tuning of the external LC antenna circuit.
The functions of the analog front-end section are controlled by the internal configuration registers. The MCU
can dynamically reprogram the internal configuration
registers based on real-time signal conditions.
The analog front-end section also has a dynamically
reconfigurable output enable filter that can allow the
MCU to wake-up to the wanted input signal only, but
ignore all other unwanted signals.
For a low-power battery operation, the device is
optimized to consume very low currents during Sleep,
Standby, and Active modes. The device can also be
operated in battery back-up and batteryless modes
using external circuits.
The device is available in a 20-pin SSOP package.
Refer to the PIC12F635/PIC16F636 data sheet [1] for
more details.
THEORY OF DEVICE OPERATION
The PIC16F639 device is a dual-die packaged device.
The microcontroller (PIC16F636) and analog front-end
device (MCP2030) are bonded together in a single
SSOP package for smart-sensing and bidirectional
communication applications. These two devices
(sections) communicate via internally connected SPI
interface pads.
The device has twelve digital I/O and four analog I/O
pins. The digital I/O pins are used the same as the
PIC16F636 device. The four analog 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 are
connected to the analog I/O pins. The device’s analog
channels are optimized for 125 kHz input signal with an
input sensitivity of about 3 mVPP.
Internal Configuration Registers
The analog front-end section has eight configuration
registers. Six of them are used for setting up the device
operation; one is for column parity bits and the last one
is for device Status indicator bits. Each register has 9
bits, including one row parity bit. The registers are readable and writable except the Status register, which is
read-only. The registers are accessible any time during
applications via SPI interface commands. The three
SPI interface pins (SDIO, CS, SCLK) are internally
bonded with the I/O pins of the digital section.
The low-frequency, front-end section can output
demodulated data, carrier clock or a received signal
strength indicator (RSSI current) by controlling the output selection bit of the internal configuration registers.
 2004 Microchip Technology Inc.
DS00959A-page 1
AN959
Low-Frequency (LF) Input Channel
The device detects LF input signals individually using x,
y and z channels. The outputs of the individual
channels are added for the final detector output. The
individual input channels can be enabled or disabled,
depending on applications, or to save operating battery
power.
External LC Resonant Circuits and
Internal Tuning Capacitors
The device needs external LC resonant circuits to
receive low-frequency input signals or to transmit data
using LF talk-back modulators. Each input channel
needs its own external LC resonant circuit. The input
voltage that is picked-up by the external LC resonant
antenna circuit is maximized when the LC circuit is
tuned precisely to the carrier frequency of the incoming
signal (carrier frequency of the base station).
The received antenna voltage is approximately given
by the following equation [2]:
EQUATION 1:
V coil = 2πfNSQB o cos α
where:
f = frequency of the arrival signal
N = number of turns of coil in the loop
S = area of the loop in square meters (m2)
Q = quality factor of the LC circuit
Βo = magnetic field strength
α = angle of arrival of the signal
In the above equation, the quality factor Q is a measure
of the selectivity of the frequency of the interest that is
tuned by the external LC circuit. The Q is defined by:
EQUATION 2:
magnetic field from the base station
Line of axis
α
Transponder’s LF antenna
With a given antenna’s physical condition, the induced
antenna voltage is a function of the angle of the arrival
signal with respect to the LF antenna. The antenna
voltage is maximized when the coil antenna is placed in
parallel with the incoming signal where α = 0, and minimized where α = 90 degrees as shown in Equation 1
and Figure 1.
For a reliable operation of the hands-free, passive keyless entry applications, it is recommended to use three
orthogonally placed antennas to detect the base
station’s LF commands from x, y and z directions.
In order to compensate the detuning effects due to the
external LC component tolerance or environmental
changes, the device has internal tuning capacitors. The
internal tuning capacitors are programmed up to 63 pF
(1 pF resolution) per channel. The internal tuning
capacitor values are programmed by the Configuration
register.
Input Signal Dynamic Range
The device can detect LF input signals from 3 mVPP to
about 700 VPP of unloaded coil voltage. The device’s
LF front-end circuit regulates the input coil voltage
below about 11 VPP to protect the internal circuits from
high input voltage.
Output Enable Filter
fo
Q = ---B
where fo is the LC tuning frequency, and B is the 3dB
bandwidth of the resonant circuit. The resonant
frequency (fo) of the LC circuit is given by:
EQUATION 3:
1
f 0 = -----------------2π LC
DS00959A-page 2
FIGURE 1: ORIENTATION DEPENDENCY OF
ANTENNA VOLTAGE
The digital section can stay in the Sleep mode for a battery saving purpose or can perform different tasks until
an output is available from the analog section. For this
purpose, the device has a programmable output enable
filter. If the input signal meets the filter requirement, it
enables the detected output, otherwise it disables the
output. The filter timing criteria consists of high and low
pulse durations of the input data header, which are programmed in the configuration register. Figure 2 shows
an example of when the output enable filter is enabled
and the input meets the filter requirement. The demodulated output is available after the output enable filter
waveform. If the demodulator output pin (LFDATA pin)
is connected to the interrupt-on-change pin (PORTA),
the digital section will wake-up by the interrupt and
decode the input data.
 2004 Microchip Technology Inc.
AN959
Figure 3 shows an example of when the input data does
not meet the output enable filter requirement. No output
is available at the demodulated data output pin. Therefore, the digital section is not waken-up by any
unwanted input signal. If the output filter is disabled,
the demodulated output is available immediately after
the device’s AGC settling time. Figure 4 shows an
example of when the output enable filter is disabled.
FIGURE 2:
INPUT SIGNAL AND DEMODULATOR OUTPUT WHEN THE OUTPUT ENABLE
FILTER IS ENABLED AND INPUT MEETS THE FILTER TIMING REQUIREMENT
Input
Signal
DATA
AGC
SETTLING TIME
OUTPUT ENABLE
FILTER TIMING
Demodulator
Output
 2004 Microchip Technology Inc.
DS00959A-page 3
AN959
FIGURE 3:
INPUT SIGNAL AND DEMODULATOR OUTPUT WHEN THE OUTPUT ENABLE
FILTER IS ENABLED AND INPUT DOES NOT MEET THE FILTER TIMING
REQUIREMENT
Input
Signal
No Output at Output Pin
FIGURE 4:
INPUT SIGNAL AND DEMODULATOR OUTPUT WHEN THE OUTPUT ENABLE
FILTER IS DISABLED
Input
Signal
Demodulator
Output
DS00959A-page 4
 2004 Microchip Technology Inc.
AN959
Output Type Selection of LF Signal
Detector
The analog front-end section can output demodulated
digital data, carrier clocks or received signal strength
indicator (RSSI) current that is proportional to the input
signal voltage. The selection of the output type is
controlled by the Configuration register.
Data Transmission from Device to Base
Station
The device has an internal modulation transistor per
each channel, which is placed across each LF antenna
and LCCOM pins. Turning on and off the modulation
transistors results in clamping and unclamping the coil
voltage. This is called an LF talk back. Two SPI
commands (Clamping-on and Clamping-off) are used
for this purpose. The Clamping-on SPI command
shorts the coil voltage and the Clamping-off SPI
command releases the shorted coil voltage. The base
station can monitor the changes in the transponder coil
voltage and reconstruct the modulation data.The LF
talk back is used for a proximity range only. The device
uses an external UHF transmitter for long range communication.
Bidirectional Communications
A low cost bidirectional communication transponder
can be designed by using dual frequencies:
a)
b)
Use 125 kHz for receiving the base station
command.
Use UHF for transmitting data from the
transponder to the base station.
Since the device does not include the UHF transmitter
internally, an external UHF transmitter is needed. The
modulation data is generated by the device and fed into
the external UHF transmitter. The modulated UHF
signal is transmitted to the base station via a small loop
antenna that is formed on the transponder Print Circuit
Board (PCB). The typical range of the UHF response is
up to 100 meters for unlicensed low-power applications.
Figure 5 shows an example of the passive keyless
entry (PKE) system using the bidirectional communications.The PKE communication sequences are as
follows:
a)
b)
c)
d)
The base station transmits commands
using 125 kHz.
The device receives the base station command via external 125 kHz LC resonant
antennas.
The transponder transmits responses
(data) via an external UHF transmitter if the
command is valid.
The base station receives the responses
and activates switches if the data is correct.
 2004 Microchip Technology Inc.
The communication distance of the dual frequency
PKE is limited by the range of the 125 kHz base station
command. This is due to the fast fall-off nature of the
125 kHz signal. The transponder’s LC resonant
antenna can be made to pick up (>3 mVPP) a typical
base station signal as far as 2 meters away from the
base station unit.
APPLICATIONS
The PIC16F639 is a good fit for smart LF sensor or lowcost bidirectional communication transponder applications. The device can be used for various applications,
particularly in the automotive and security industries.
Automotive Industry
•
•
•
•
Passive Keyless Entry (PKE) system
Remote door locks and gate openers
Engine immobilizer
LF initiator sensor for tire pressure monitoring
systems
Security Industry
•
•
•
•
Long range access control
Parking lot entry
Hands-free apartment door access
Asset control and management
Application Examples
Figure 5 shows an example of the Passive Keyless
Entry (PKE) system. The base station transmits 125
kHz command. If the command is detected, the PKE
transponder responds via an external UHF transmitter
or by using internal LF talk back modulators. The three
LF antennas are used to pick-up the base station
commands from x, y and z directions.
Figure 6 shows an example of the Passive Keyless
Entry (PKE) transponder configuration using the
device. An air-core coil antenna is connected to the
LCX input pin, while the ferrite-core antennas are
connected to the LCY and LCZ input pins.
Figure 7 shows an example of the passive keyless
entry (PKE) transponder for multi-purpose applications. One transponder can be used for various access
control applications.
Figure 8 shows an example when the device is used for
tire pressure monitoring sensor applications. The
device detects the LF commands from the LF initiator
and transmits the tire pressure data to the base station
via an external UHF transmitter.
DS00959A-page 5
AN959
FIGURE 5:
BIDIRECTIONAL PASSIVE KEYLESS ENTRY (PKE) SYSTEM
d
Encrypte
Codes
se
Respon
(UHF)
LED
LED
UHF
Transmitter
Microcontroller
(MCU)
UHF
Receiver
Ant. X
mand
LF Com z)
k
(125 H
PIC16F639
MCU
(PIC16F636)
Ant. Y
LF
Transmitter/
Receiver
+
Ant. Z
3 Input
Analog Front-End
Device
LF Talk Back
(125 kHz)
Transponder
Base Station
PASSIVE KEYLESS ENTRY (PKE) TRANSPONDER CONFIGURATION
+3V
315 MHz
VDD
S0
S1
S2
RF Circuitry
(UHF TX)
Data
RFEN
LFDATA/RSSI/SCLK/SDIO
+3V
VDDT
LCX
LCY
air-core
coil
DS00959A-page 6
1
20
2
19
3
18
4
17
5
6
7
+3V
+3V
S3
S5
16
15
14
8
13
9
12
10
11
ferrite-core
coil
VSS
S4
PIC16F639
FIGURE 6:
LED
CS
SCLK/ALERT
VSST
LCCOM
LCZ
ferrite-core
coil
 2004 Microchip Technology Inc.
AN959
FIGURE 7:
PASSIVE KEYLESS ENTRY (PKE) TRANSPONDER FOR MULTI-PURPOSE APPLICATIONS
PARKING
UHF
Home Access
UHF
125 kHz
125 kHz
K
UHF
Parking Lot Access
PKE Transponder
125 kHz
Car Access
FIGURE 8:
TIRE PRESSURE MONITORING SENSOR APPLICATIONS
RF Receiver
UHF
tire respon
pres
s
sure e with
data
MCU
RF Transmitter
Tire
Pressure
Sensor
Initiator
125 kHz
m
com and
LF Initiator
PIC16F639
Note 1: The LF initiator sends LF commands for the tire pressure data.
2: The PIC16F639 picks up the LF commands and transmits the tire pressure data via an
external UHF transmitter.
 2004 Microchip Technology Inc.
DS00959A-page 7
AN959
CONCLUSION
REFERENCE
The PIC16F639 is an MCU-based, low-frequency
detector and transmitter. The device can be used for
various intelligent bidirectional communication transponders. By using the device with an external UHF
transponder, a low cost Passive Keyless Entry (PKE)
transponder can be designed. For secure data communications, the device can transmit and receive
encrypted data by using the built-in KEELOQ cryptographic hardware peripheral.
[1] PIC12F635/PIC16F636 data sheet, Microchip
Technology Inc.
[2] Antenna circuit design for RFID applications,
AN710, Microchip Technology Inc.
The device’s high input sensitivity for low frequency
(125 kHz) signal is also appropriate as a magnetic field
sensor.
The device can also be operative in batteryless and
battery back-up modes with appropriate external voltage charge-up circuits.
MCU Firmware Development Tools
Compatible with the PIC16F636 development tools:
• MPLAB® Integrated Development Environment
(IDE)
• MPLAB® ICE 2000 In-Circuit Emulator
• MPLAB® PM3 Universal Device Programmer
• PICSTART® Plus Low-cost Development System
• MPLAB® ICD 2 In-Circuit Debugger
• PICkit™ 1 Flash Starter Kit
DS00959A-page 8
 2004 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, 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, Migratable Memory, MPASM,
MPLIB, MPLINK, MPSIM, PICkit, PICDEM, PICDEM.net,
PICLAB, PICtail, PowerCal, PowerInfo, PowerMate,
PowerTool, rfLAB, rfPICDEM, Select Mode, Smart Serial,
SmartTel and Total Endurance 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.
© 2004, 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.
 2004 Microchip Technology Inc.
DS00959A-page 9
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 - Weis
Tel: 43-7242-2244-399
Fax: 43-7242-2244-393
Denmark - Ballerup
Tel: 45-4450-2828
Fax: 45-4485-2829
China - Chengdu
Tel: 86-28-8676-6200
Fax: 86-28-8676-6599
Japan - Kanagawa
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
France - Massy
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
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Germany - Ismaning
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Alpharetta, GA
Tel: 770-640-0034
Fax: 770-640-0307
Boston
Westford, MA
Tel: 978-692-3848
Fax: 978-692-3821
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
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
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
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Kaohsiung
Tel: 886-7-536-4818
Fax: 886-7-536-4803
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
England - Berkshire
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Taiwan - Hsinchu
Tel: 886-3-572-9526
Fax: 886-3-572-6459
China - Qingdao
Tel: 86-532-502-7355
Fax: 86-532-502-7205
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
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
10/20/04
DS00959A-page 10
 2004 Microchip Technology Inc.
Similar pages