Sunday 27 January 2019

Discrete IR Codes for Panasonic Viera and Denon RC-DM41DAB Hifi

These are lircd.conf files for infrared codes which are supported by the device, but not possible to produce with the remote control.

Panasonic Viera TX50CX

begin remote

  name panasonic

  bits            24
  flags           SPACE_ENC
  eps             30
  aeps            100

  header          3455  1736

  one             433   1305
  zero            433   436
  ptrail          433
  pre_data_bits   24
  pre_data        0x400401
  gap             74568
  toggle_bit_mask 0x0
  frequency       38000
    begin codes
          EXT_ON                   0x007C7D
          EXT_OFF                  0x00FCFD
          EXT_AV1                  0x008081
          EXT_AV2                  0x004041
          EXT_HDMI1                0x200D2C
          EXT_HDMI2                0x208DAC
          EXT_HDMI3                0x204D6C
          EXT_UHF                  0x40EEAF
          EXT_DVB                  0x401E5F
          EXT_FREESAT              0x409EDF
          EXT_OTHERSAT             0x405E1F

          EXT_MEDIA                0x90D544
    end codes
end remote

Denon RC-DM41DAB


begin remote
  name            RC1214
  bits            24
  flags           SPACE_ENC
  eps             30
  aeps            100

  header          3479  1712

  one             420   1261
  zero            420   425
  ptrail          420
  pre_data_bits   24
  pre_data        0x2A4C0A
  gap             50587
  toggle_bit_mask 0x0
  frequency       38000
    begin codes
          EXT_ON                   0x880280
          EXT_OFF                  0x84028C
          EXT_DAB                  0x65026D
          EXT_FM                   0x690261
          EXT_AM                   0x610269
          EXT_CDPLAY               0xC102C9
          EXT_PAUSE                0x890281
          EXT_DISC                 0x89C241
          EXT_FOLDER               0x81C249
    end codes
end remote

Format of the Commands

The commands are in the format:

       16 Bits          8 Bits              16 Bits           8 Bits
+-------------------+----------------+----------------------+-----------+
| Manufacturer Code | Device         |    Function Code     | Check sum |
+-------------------+----------------+----------------------+-----------+
 lsb                 lsb              lsb                    lsb

The Checksum is a simple Xor of the Device and Function Code Bytes

The msb/lsb are the opposite way around to 'normal' so the codes must be modified (flipped) for the lirc configuration files.


Panasonic Viera Worked Example

The Device code for Panasonic is an 8-bit number.
The Function Code is made up of an 8-bit sub device and an 8-bit original button code

       16 Bits          8 Bits          8 Bits     8 Bits     8 Bits
+-------------------+----------------+----------+-----------+-----------+
| Manufacturer Code | Device         | Sub Dev  |    OBC    | Check sum |
+-------------------+----------------+----------+-----------+-----------+

The Manufacturer code for the panasonic TV is 144, and the device ID is 128

    0x2002 -> 0010 0000 0000 0010
                      <--> 
              0100 0000 0000 0100 -> 0x4004

    0x80   ->  1000 0000
                 <-->
               0000 0001  -> 0x01

So the Pre-Data in the lirc configuration file is 0x400401


The 'Extended On' command command for device 128 is subdevice 0, OBC 62

    0x00   ->  0000 0000
                 <-->
               0000 0000  -> 0x00

    0x3E   ->  0011 1110
    62(dec)      <-->
               0111 1100  -> 0x7C   

So the Function Code for this command ix 0x007C

The Checksum is 0x01 xor 0x00 xor 0x7C -> 0x7D

So the code for 'Extended On' in the lirc configuration file is 0x007C7D




Denon RC1214 Worked Example

The Device Code in Denon Terminology is made of a nybble of zeroes, and a 4-bit Genre 1
The Function Code in Denon Terminology is made of a 4-bit Genre 2 and a 12-bit Data code

       16 Bits                4 Bits    4 Bits     12 Bits       8 Bits
+-------------------+------+----------+--------+-------------+-----------+
| Manufacturer Code | 0000 |  Genre1  | Genre2 |    Data     | Check sum |
+-------------------+------+----------+--------+-------------+-----------+

The Manufacturer Code for the RC1214 remote is: 0x3254, and all commands have a Genre1 of 5, but the numbers are stored lsb first, so they need flipping around:

    0x3254 -> 0011 0010 0101 0100
                      <--> 
              0010 1010 0100 1100 -> 0x2A4C

    0x5   ->  0101
              <-->
              1010  -> 0xA

So the Pre-Data in the lirc configuration file is 0x2A4C0A

The Genre2 code and data codes for the Extended 'On' command are 0x01 and 0x401 respectively, but need msb/lsb flipping:

    0x1  -> 0001
            <--> 
            1000 -> 0x8

    0x401-> 0100 0000 0001
                 <-->
            1000 0000 0010 -> 0x802

So the Function Code for this command is 0x8802


The Checksum is 0x0A xor 0x88 xor 0x02 -> 0x80

So the code for 'Extended On' in the lirc configuration file is 0x880280