CCF Decode Example

By Jim Pollock

Last updatedJan 11,2000


Discrete IR Codes Format:
The IR signature for each key stored in the CCF file is recorded as a series of two byte (16 bit) numbers. These are referred to as Raw Codes or Discrete IR Codes and have the format of a header followed by a series of number pairs. The header is normally made up of the first four numbers (eight bytes). Next come a series of number pairs that indicate the number of clock ticks that the IR Signal was ON and then the number of clock ticks the IR Signal was OFF. Each tick is equal to 23 usec. The numbers are in hexadecimal so 0016 hex is really 22 decimal (16+6). You then multiply 22 by 23 usec to get 506 usec. This would be the number of usec the IR Signal was ON if it was the first number or the time OFF if the second number of the pair.

The first task is to separate the header from the ON/OFF number pairs. It is best to start at the end and work back to the front. The last number is normally very large and represents the time between complete code bursts. If more than one code burst has been recorded you will be able to see this same number (plus or minus a few counts) somewhere earlier in the string of numbers. The numbers recorded vary by a few counts due to the effects of sampling and small timing variations. This is not a problem since we will be looking for variations of 2,3,4...8 or more times between the different pulse types.

Example Raw code for a Pioneer DVD Player Model DV-717 Function = "Play" (Subpanel 739 of 1304)

Action type

Action parameters

Code

[C] RawCode("Learned","0000 0067 0000 0022 0155 00ac 0016 003f 0016
003f 0016 0015 0016 0015 0016 0015 0016 003f 0016 0015 0016 003f
0016 0015 0016 0015 0016 003f 0016 003f 0016 003f 0016 0015 0016
003f 0016 0015 0016 0015 0016 003f 0016 003f 0016 003f 0016 003f
0016 0015 0016 0015 0016 003f 0016 003f 0016 0015 0016 0015 0016
0015 0016 0015 0016 003f 0016 003f 0016 0015 0016 0597")

If we look at the example above the last number is 597 hex. If you do the math this works out to 32917 usec or around 33 milliseconds between bursts. This is a normal OFF time between bursts, which can range from 25 to 120 milliseconds. Looking back through the numbers we see no other similar value so there seems to be only one burst here. Let's now parse the numbers into pairs. To make decoding easier the large OFF time is placed on a separate line so the first number of all the preceding pairs is the OFF time. When we get to the top we should find one or more sync pulses. These are used to wake up the IR receiver and set the amplifier gain.

0000 0067 0000 0022 CCF Header - We are not interested in this part.

Sync Pulses
ON OFF ON
0155 00ac 0016 Counts
7843 3956 506 usec

These three numbers give us most of the information needed to setup the first panel of the "User Protocol". Panel 1 of 4 lets you define a Sync Pulse stream of up to two pulses with a space after each one. In this example we only need to fill in three of the four fields. Although you could enter the values just as I have them listed above it is best to round them up to some "magic" values. For best performance I recommend all values be multiples of 260 usec. and rounded up. If you look at these three numbers you can see a ratio of 16:8:1 between the numbers so I try to keep this same ratio in the values I enter. Keeping all this in mind I would select "Sync A Pulse"=8320 usec., "Sync A Space"=4160 usec., and "Sync B Pulse"=520 usec. "On" is the same as "Pulse" and "Off" is the same as "Space". It is best to be on the large size since the pulses tend to shrink by the time the receiver sees them. We can not yet fill in the # Group Bits until we look at the remaining number pairs.

Custom Protocol (1 of 4)
Sync A Pulse (Width usec) 8320
Sync A Space 4160
Sync B Pulse 520
Sync B Space 0
# Group Bits (0-32) ?

The following table is a result of parsing the remaining pairs. I have grouped the pairs into blocks of four. Examining the table you can determine the coding used for zeroes and ones and the number of bits in the code. For this table you see that the ON time is always the same value 16 (or 506 usec). The Off time toggles between two values 3F and 15 which correspond to 1638 usec and 546 and have a ratio of 3:1. So it appears the encoding for a logic ONE is a long Space three times the size of the following Pulse and a logic zero is a Space of equal size to the following Pulse. If we count the pairs we have a total of 32. I have grouped these into fours and added the hexadecimal value for each group.

This gives us a 32 bit code value of C53A 7986. If you decoded more functions you would see a pattern where the first 16 bits (four hex characters) are always the same but the last 16 bits are different for each function. The first number is referred to as a "Group" code and is different for each type of device (i.e. TV, DVD, CD...). If you look a little closer at these first 16 bits you will notice that there is a pattern between the first 8 and second 8. One is the complement (opposite) of the other. If you add the two bytes together you will get FF. This is normally the case but there are exceptions since to follow this rule gives you only 256 device types. There are many companies that use this type of code and each produces several types of products. At this point we can complete panel 1 of 4 by entering 16 as the number of group bits

Custom Protocol (1 of 4)
Sync A Pulse (Width usec) 8320
Sync A Space 4160
Sync B Pulse 520
Sync B Space 0
# Group Bits (0-32) 16

 

OFF ON Code
003f 0016
003f 0016
0015 0016
0015 0016
1
1
0
0
C  
0015 0016
003f 0016
0015 0016
003f 0016
0
1
0
1
5  
0015 0016
0015 0016
003f 0016
003f 0016
0
0
1
1
3  
003f 0016
0015 0016
003f 0016
0015 0016
1
0
1
0
A  
0015 0016
003f 0016
003f 0016
003f 0016
0
1
1
1
7  
003f 0016
0015 0016
0015 0016
003f 0016
1
0
0
1
9  
003f 0016
0015 0016
0015 0016
0015 0016
1
0
0
0
8  
0015 0016
003f 0016
003f 0016
0015 0016
0
1
1
0
6  
0597 ----      

On panel 2 of 4 you can enter in the Group code of C53A. Next is the number of Function bits which at first might look like 16 bits but in fact will be entered as 8 bits. The 16 function bits also follow the complement byte rule and in this case there are no exceptions as this is how the receiver tells this is a valid code. The two bytes must be complements. Instead of having to enter a 16 bit value for each function you can have my program generate the second check byte. I currently support four different types of check bytes or codings. This one is called "True-Comp".

There are two other fields on panel 2. Bit Order controls whether the Least Significant bit is sent out first or the Most Significant bit is sent first. I allow both to make it easier to enter codes and keep the codes grouped together. Sony just happens to use LSB but other use MSB. This will make more sense when you have a table of codes. If you pick the right direction codes will be numerically grouped together. If you pick the wrong direction the codes will jump around. The best way to determine which to use is to decode the number pad keys 0-9. When you look at the code you should be able to see the incrementing pattern. The last field on the panel controls sending a Stop burst. For now just select NO. I have found only one device that requires this feature. After you send the burst that selects the function you must send a fixed pattern burst to cause it to be executed. Just select No.

Custom Protocol (2 of 4)
Group Code (Hex) C53A
# Func Bits 6-16 8
Bit Order MSB 1st
Check Coding True-Comp
Send Stop No

Panel 3 is where you define what a Zero and One pulse stream look like. The "*" by two of the fields means you must fill in these fields with a non-zero value. From the table above a zero is a 520 usec Space followed by a 520 usec Pulse and there is no Space after the Pulse so that field is 0. The One definition can have up to two Pulses each followed by a Space. In this example we only need to use two of the four fields so the unused fields are set to zero. We start with the 1 Space field and enter 1520 (3*520) and then fill in the mandatory 1 *Pulse field with 520 usec.

Define 0/1 Pulses (3 of 4)
0 Space Width us.: 520
0 *Pulse: 520
0 Space: 0
1 Pulse: 0
1 Space: 1520
1 *Pulse: 520
1 Space: 0

The last Panel has only two fields and the first one we already have. The time between bursts was 33 msec so this is where it goes. The Default Repeat field can be left at its default value. Each key you define can have its own Repeat value this field just defines the default value used when you first define the key. A value of two means that a minimum of two bursts of the code are sent out. So if you just tap a key you will always send two bursts of the code. If you hold the key down the bursts keep being sent after the defined delay time.

Custom Protocol (4 of 4)
Default Delay (ms): 33
Default Repeat: 2

Well we are at the end for now. Please send me your questions and I will try to update this document to cover them. If you see any errors here send them too.

Hosted by www.Geocities.ws

 1