English
Language : 

HCS512 Datasheet, PDF (6/20 Pages) Microchip Technology – KEELOQ CODE HOPPING DECODER
HCS512
4.0 DECODER OPERATION
4.1 Learning a Transmitter to a Receiver
Either the serial number-based learning method or the
seed-based learning method can be selected. The
learning method is selected in the configuration byte. In
order for a transmitter to be used with a decoder, the
transmitter must first be ‘learned’. When a transmitter is
learned to a decoder, the decoder stores the encoder
key, a check value of the serial number and current syn-
chronization value in EEPROM. The decoder must
keep track of these values for every transmitter that is
learned. The maximum number of transmitters that can
be learned is four. The decoder must also contain the
Manufacturer’s Code in order to learn a transmitter. The
Manufacturer’s Code will typically be the same for all
decoders in a system.
The HCS512 has four memory slots. After an “erase all”
procedure, all the memory slots will be cleared. Erase
all is activated by taking LRNIN low for approximately
10 seconds. When a new transmitter is learned, the
decoder searches for an empty memory slot and stores
the transmitter’s information in that memory slot. When
all memory slots are full, the decoder randomly over-
writes existing transmitters.
4.1.1 LEARNING PROCEDURE
Learning is activated by taking the LRNIN input low for
longer than 64 ms. This input requires an external pull-
up resistor.
To learn a new transmitter to the HCS512 decoder, the
following sequence is required:
1. Enter learning mode by pulling LRNIN low for
longer than 64 ms. The LRNOUT output will go
high.
2. Activate the transmitter until the LRNOUT output
goes low indicating reception of a valid code
(hopping message).
3. Activate the transmitter a second time until the
LRNOUT toggles for 4 seconds (in secure learn-
ing mode, the seed transmission must be trans-
mitted during the second stage of learn by
activating the appropriate buttons on the trans-
mitter).
If LRNIN is taken low momentarily during the
learn status indication, the indication will be ter-
minated. Once a successful learning sequence
is detected, the indication can be terminated
allowing quick learning in a manufacturing setup.
4. The transmitter is now learned into the decoder.
5. Repeat steps 1-4 to learn up to four transmitters.
6. Learning will be terminated if two non-sequential
codes were received or if two acceptable codes
were not decoded within 30 seconds.
The following checks are performed on the decoder to
determine if the transmission is valid during learn:
• The first code word is checked for bit integrity.
• The second code word is checked for bit integrity.
• The hopping code is decrypted.
• If all the checks pass, the serial number and syn-
chronization counters are stored in EEPROM
memory.
Figure 4-1 shows a flow chart of the learn sequence.
FIGURE 4-1: LEARN SEQUENCE
Enter Learn
Mode
Wait for Reception
of a Valid Code
Wait for Reception
of Second
Non-Repeated
Valid Code
Generate Key
from Serial Number
or Seed Value
Use Generated Key
to Decrypt
Compare Discrimination
Value with Serial Number
Equal
No
?
Yes
Learn successful. Store:
Serial number check value
Synchronization counter
Encoder Key
Learn
Unsuccessful
Exit
4.2 Validation of Codes
The decoder waits for a transmission and checks the
serial number to determine if the transmitter has been
learned. If learned, the decoder decrypts the encrypted
portion of the transmission using the encoder key. It
uses the discrimination bits to determine if the decryp-
tion was valid. If everything up to this point is valid, the
synchronization value is evaluated.
DS40151C-page 6
© 1997 Microchip Technology Inc.