DataSheet.es    


PDF AN744 Data sheet ( Hoja de datos )

Número de pieza AN744
Descripción Modular Mid-Range PICmicro KEELOQ Decoder
Fabricantes Microchip 
Logotipo Microchip Logotipo



Hay una vista previa y un enlace de descarga de AN744 (archivo pdf) en la parte inferior de esta página.


Total 28 Páginas

No Preview Available ! AN744 Hoja de datos, Descripción, Manual

M
AN744
Modular Mid-Range PICmicro® KEELOQ® Decoder in C
Author: Lucio Di Jasio
Microchip Technology Inc.
OVERVIEW
This application note describes a KEELOQ code hop-
ping decoder implemented on a Microchip Mid-range
Enhanced FLASH MCU (PIC16F872). The software
has been designed as a group of independent modules
(standard C source files "C" ).
For clarity and ease of maintenance, each module cov-
ers a single function. Each module can be modified to
accommodate a different behavior, support a different
MCU, and/or a different set of peripherals (memories,
timers, etc.).
KEY FEATURES
The set of modules presented in this application note
implement the following features:
• Source compatible with HITECH and CCS C
compilers
• Pin out compatible with PICDEM-2 board
• Normal Learn mode
• Learn up to 8 transmitters, using the internal
EEPROM memory of PIC16F872
• Interrupt driven Radio Receive (PWM) routine
• Compatible with all existing KEELOQ hopping code
encoders with PWM transmission format
selected, operating in "slow mode" (TE = 400 µs)
• Automatic synchronization during receive, using a
4 MHz RC oscillator
FIGURE 1: DECODER PIN OUT
MCLR
LRNOUT
RFIN
NU
NU
LEARN
NU
VSS
OSCIN
OSCOUT
NU
NU
NU
NU
1
2
3
4
5
6
7
8
9
10
11
12
13
14
28 NU
27 NU
26 VLOW
25 LEARNOUT
24 OUT3
23 OUT2
22 OUT1
21 OUT0
20 VDD
19 VSS
18 NU
17 NU
16 NU
15 NU
TABLE 1:
FUNCTIONAL INPUTS AND
OUTPUTS
Pin Pin Input/
Name Number Output
Function
RFIN
3 I Demodulated
PWM signal from
RF receiver
LEARN
6
I Input to enter learn
mode
LEARN-
OUT
25
O Output to show the
status of the learn
process
OUT0..3 21,22,2
3, 24
O Function outputs,
correspond to
encoder input pin
VLOW
26 O Low Battery indica-
tor, as transmitted
by the encoder
VDD 20 PWR 5V power supply
VSS 19, 8 GND Common ground
Note: All NU pins are tristate
Notice:
This is a non-restricted version of Application Note AN745 which is available under the KEELOQ License
Agreement. The license agreement can be ordered from the Microchip Literature Center as DS40149.
2001 Microchip Technology Inc.
Preliminary
DS00744A-page 1

1 page




AN744 pdf
The 16-bit synchronization counter value is stored in
memory twice because it is the most valuable piece of
information in this record. It is continuously updated at
every button press on the remote. When reading the
two stored synchronous values, the decoder should
verify that the two copies match. If not, it can adopt any
safe resync or disable technique required depending
on the desired system security level .
The current implementation limits the maximum num-
ber of transmitters that can be learned to eight. This is
due to the size of the internal EEPROM of the
PIC16F872.
This number can be changed to accommodate different
PICmicro models and memory sizes by modifying the
value of the constant MAX_USER.
The simple "linear list" method employed can be scaled
up to some tens of users. But due to its simplicity, the
time required to recognize a learned transmitter grows
linearly with the length of the table.
It is possible to reach table sizes of thousands of trans-
mitters by replacing this module with another module
that implements a more sophisticated data structure
like a Hash Tableor other indexing algorithms.
Again due to the simplicity of the current solution, it is
not possible to selectively delete a transmitter from
memory. The only delete function available is a Bulk
Erase (complete erase of all the memory contents) that
happens when the user presses the Learn button for up
to 10 seconds. (The LED will switch off. At the release
of the button, it will flash once to acknowledge the
delete command). To allow for selective transmitter
removal from memory, more sophisticated techniques
will be analyzed in future application notes, by simply
replacing/updating this module.
MEM-87X MODULE
This module is optimized to drive the internal EEPROM
of the PIC16F87X device.
The module make the memory generically accessible
by means of two routines RDword and WRword that
respectively read and write a 16-bit value out of an
even address specified in parameter IND.
Replacing this module with the appropriate drivers,
(and adapting the pin out) make possible the use of any
kind of nonvolatile memory. This includes internal and
external serial EEPROMs (Microwire®, SPIor I2C
bus) of any size up to 64 Kbytes.
AN744
THE MAIN PROGRAM
The main program is reduced to a few pages of code.
The behavior is designed to mimic the basic behavior
of the HCS512 integrated decoder, although just the
parallel output is provided (no serial interface).
Most of the time, the main loop goes idle waiting for the
receiver to complete reception a full code-word.
Double buffering of the receiver is done in RAM, in
order to immediately re-enable the reception of new
codes and increase responsiveness and perceived
range.
CONCLUSION
The C language source increases the readability of the
program structure and eases the maintenance. This
benefit has come at the cost of the program size. That
in terms of memory words, has considerably increased
over the equivalent code written in assembly (more
than 30% larger).
Selecting a FLASH PICmicro microcontroller from the
mid-range family as the target MCU allows us to make
the code simpler and cleaner. It also provides larger
RAM memory space and a deeper hardware stack.
Interrupts have been used to "virtualize" the receiving
routine as a software peripheral and to free the design
of the hard real time constraint that it usually poses.
Still, many of the resources available on the
PIC16F872 are left unused and available to the
designer. These include:
Timer1, a 16-bit timer
Timer1 oscillator, a low power oscillator for real
time clock
CCP module, capable of capture, compare and
PWM generation
Timer2, an 8-bit timer, with auto reload
10-bit A/D converter with a 5 channel input
multiplexer
We resisted introducing extra features and optimiza-
tions in favor of clarity. For example:
Speed optimizations and code compacting
More complex key generation schemes
Multiple manufacturer codes
Co-processor functionality
Advanced user entry and deletion commands
Large memory tables (up to 8,000 users)
Serial interface to PDAs and/or terminals for
memory management and logging
These are left as exercises to the advanced reader/
designer or as suggestions for further application
notes.
2001 Microchip Technology Inc.
Preliminary
DS00744A-page 5

5 Page





AN744 arduino
AN744
// keeloq receive buffer map
//
// | Plain text
| Encrypted
// RV000000.KKKKIIII.IIIIIIII.IIIIIIII.IIIIIIII.KKKKOODD.DDDDDDDD.SSSSSSSS.SSSSSSSS
// 8 7 6
5
43
210
//
// I=S/N -> SERIAL NUMBER
(28 BIT)
// K=KEY -> buttons encoding
(4 BIT)
// S=Sync -> Sync counter
(16 BIT)
// D=Disc -> Discrimination bits (10 BIT)
// R=Rept -> Repeat/first
(1 BIT)
// V=Vlow -> Low battery
(1 BIT)
//
//-- alias -------------------------------------------------------------
//
#define
HopLo Buffer[0] //sync counter
#define
HopHi Buffer[1] //
#define
DisLo Buffer[2] //discrimination bits LSB
#define DOK Buffer[3] //Disc. MSB + Ovf + Key
#define
IDLo Buffer[4] //S/N LSB
#define
IDMi Buffer[5] //S/N
#define
IDHi Buffer[6] //S/N MSB
#define S0 5 // Buffer[3] function codes
#define S1 6 // Buffer[3] function codes
#define S2 7 // Buffer[3] function codes
#define S3 4 // Buffer[3] function codes
#define VFlag 7// Buffer[8] low battery flag
//----------------- flags defines ------------------------------------
bit FHopOK;
// Hopping code verified OK
bit FSame;
// Same code as previous
bit FLearn;
// Learn mode active
bit F2Chance; // Resync required
//--------------------------------------------------------------------
// timings
//
#define TOUT 5
// 5 * 71ms = 350ms output delay
#define TFLASH 2
// 4 * 71ms = 280ms half period
#define TLEARN 255
// 255 * 71ms = 18s learn timeout
//byte Flags;
// various flags
byte CLearn, CTLearn;
// learn timers and counter
byte CFlash, CTFlash;
// led flashing timer and counter
byte COut;
// output timer
byte FCode;
// function codes and upper nibble of serial number
word Dato;
word Ind;
word Hop;
word EHop;
word ETemp;
// temp storage for read and write to mem.
// address pointer to record in mem.
// hopping code sync counter
// last value of sync counter (from EEPROM)
// second copy of sync counter
//
// interrupt receiver
//
#include "rxim.c"
//
// external modules
//
#include "mem-87x.c"
// EEPROM I2C routines
2001 Microchip Technology Inc.
Preliminary
DS00744A-page 11

11 Page







PáginasTotal 28 Páginas
PDF Descargar[ Datasheet AN744.PDF ]




Hoja de datos destacado

Número de piezaDescripciónFabricantes
AN7410AN7410ETC
ETC
AN7410NFM Stereo Multiplex DemodulatorMatsushita
Matsushita
AN7411fM STEREO MULTIPLEX DEMODULATORPanasonic Semiconductor
Panasonic Semiconductor
AN7415FM Stereo Multiplex DemodulatorPanasonic
Panasonic

Número de piezaDescripciónFabricantes
SLA6805M

High Voltage 3 phase Motor Driver IC.

Sanken
Sanken
SDC1742

12- and 14-Bit Hybrid Synchro / Resolver-to-Digital Converters.

Analog Devices
Analog Devices


DataSheet.es es una pagina web que funciona como un repositorio de manuales o hoja de datos de muchos de los productos más populares,
permitiéndote verlos en linea o descargarlos en PDF.


DataSheet.es    |   2020   |  Privacy Policy  |  Contacto  |  Buscar