2002 Microchip Technology Inc.
Preliminary
DS41111D-page 11
HCS370
3.2
Code Word Format
A K
EE
L
OQ
code word consists of 32 bits of hopping
code data, 32 bits of fixed code data, and between 3 to
5 bits of status information. Various code word formats
are shown in Figure 3-1 and Figure 3-2.
3.2.1
HOPPING CODE PORTION
The hopping code portion is calculated by encrypting
the counter, discrimination value, and function code
with the Encoder Key (KEY). The hopping code is cal-
culated when a button press is debounced and remains
unchanged until the next button press.
The synchronization counter can be either a 16- or 20-
bit value. The Configuration Option Counter Select
(CNTSEL) will determine this. The counter select option
must be the same for both Encoder 1 and Encoder 2.
If the 16-bit counter is selected, the discrimination value
is 10 bits long and there are 2 counter overflow bits
(OVR0, OVR1). Set both bits in production and OVR0
will be cleared on the first counter overflow and OVR1 on
the second. Clearing OVR0 with OVR1 set will only
detect the first overflow. Clearing both OVR bits will
effectively give 12 constant bits for discrimination.
If the counter is 20 bits, the discrimination value is 8 bits
long and there are no overflow bits. The rest of the 32
bits are made up of the function code also known as the
button inputs.
The discrimination value can be programmed with any
value to serve as a post decryption check on the
decoder end. In a typical system, this will be pro-
grammed with the 8 or 10 Least Significant bits of the
serial number. This will be stored by the receiver sys-
tem after a transmitter has been learned. The discrimi-
nation bits are part of the information that is to form the
encrypted portion of the transmission.
3.2.2
FIXED CODE PORTION
The 32 bits of fixed code consist of 28 bits of the serial
number (SER) and a copy of the 4-bit function code.
This can be changed to contain the whole 32-bit serial
number by setting the Extended Serial Number (XSER)
configuration option to a 1. If more than one button is
pressed, the function codes are logically OR’ed
together. The function code is repeated in the
encrypted and unencrypted data of a transmission.
TABLE 3-4:
FUNCTION CODES
3.2.3
STATUS INFORMATION
The status bits will always contain the output of the Low
Voltage (V
LOW
) detector and Cyclic Redundancy
Check (CRC). If Queue (QUEN) is enabled, button
queue information will be included in the code words.
FIGURE 3-1:
CODE WORD DATA FORMAT (16-BIT COUNTER)
Button
Function Code
2
xx1x
2
x1xx
2
1xxx
2
xxx1
2
111x
2
11x1
2
S0
S1
S2
S3
S4
S5
Fixed Code Portion (32 Bits)
CRC
2 Bits
V
LOW
1-Bit
SERIAL NUMBER
(28 Bits)
C1
C0
S2
S1
S0
S3
BUT
4 Bits
Counter
Overflow
2 Bits
DISC
10 Bits
Synchronization
Counter
16 Bits
15
0
S1
S2
S0
S3
OVR1
OVR0
Transmission Direction LSB First
Hopping Code Portion (32 Bits)
With XSER=0, 16-bit Counter, QUEN=0
Status Information
(3 Bits)
BUT
4 Bits
Fixed Code Portion (32 Bits)
QUE
2 Bits
CRC
2 Bits
V
LOW
1-Bit
SERIAL NUMBER
(32 Bits)
Q1
Q0
C1
C0
BUT
4 Bits
Counter
Overflow
2 Bits
DISC
10 Bits
Synchronization
Counter
16 Bits
15
0
S2
S1
S0 S3
OVR1
OVR0
Hopping Code Portion (32 Bits)
With XSER=1, 16-bit Counter, QUEN=1
Status Information
(5 Bits)