On Tue, 12 Feb 2013 09:09:57 -0800, mba <datscharf@...> wrote:
> Power is 16 12 (System Command)
>
> Is there any way to create the raw code section according to the
> system/command I listed.
>
The two number (System Command) codes are standard RC5 protocol and don't
need to be specified in raw format. Below is a lircd.conf I recently
submitted for Marantz equipment. It contains 2 remotes: Marantz_RC2000 for
standard RC5 codes (System Command), and Marantz_RC200x that uses raw
codes for RC5x commands (System Command Data).
If you want to make raw codes anyway, read on.
For RC5 (your 2 number System Command), the format is:
Start, Inverted MSB of Command, Toggle, 5 bits of System, Lower 6 bits of
Command
Code 16 12:
16 = 10000b (5 bit System)
12 = 0001100b (7 bit Command)
Start is a 1, inverted MSB of Command is 1, toggle is typically written as
a 0.
So 16 12 becomes 11010000001100. In the lircd.conf below, the start bit is
handled by plead, leaving only 1010000001100, which is why the hex code
for POWER_ON/OFF is shown as 0x140C and not 0x340C
To make raw codes, let's use "A" to mean an 890us pulse of IR, and "B" to
mean an 890us space of no IR. For RC5, each bit is encoded as follows:
0: AB
1: BA
So the binary code for the power toggle command gets translated as follows:
1 1 0 1 0 0 0 0 0 0 1 1 0 0
BA BA AB BA AB AB AB AB AB AB BA BA AB AB
The numbers in the raw_codes section of lircd.conf are lengths for an IR
pulse, IR space, IR pulse, IR space, etc... Raw codes ALWAYS begin and end
with a pulse, so ignore the leading "B" (space) in the command and any
trailing "B". Finally, convert each string of A's and B's into the
appropriate length of IR pulse or space.
Ignoring the leading and trailing B:
A BA AB BA AB AB AB AB AB AB BA BA AB A
Grouping the A's and B's for clarity:
A B AA BB AA B A B A B A B A B A BB A B AA B A
Substituting the proper number of microseconds for each pulse/space:
A (890), B (890), AA (1780), BB (1780), AA (1780), B (890), ...
This then becomes:
name power_toggle
890 890 1780 1780 1780 890
890 890 890 890 890 890
890 890 890 1780 890 890
1780 890 890
As you can see, each number is a multiple of 890. When using irrecord to
generate raw codes there is some measurement error, so the numbers won't
always be exact multiples. Compare your power ON to mine:
name PowerOn
810 938 1727 1813 1706 917
831 938 853 895 810 4479
810 938 853 1791 810 938
1706 917 810 938 853 895
831 938 853 895 831 938
853 1791 853
# Command 16 12 01
name POWER_ON
890 890 1780 1780 1780 890
890 890 890 890 890 4450
890 890 890 1780 890 890
1780 890 890 890 890 890
890 890 890 890 890 890
890 1780 890
Not too different. Looks like your remote (or IR receiver) has a slightly
longer space than pulse. There's a fair tolerance in IR commands, so
either one will work. My codes were tested on a Marantz SR8000 A/V
Receiver.
HTH,
Adrian
# lircd.conf.RC2000
#
# These codes are for the Marantz RC2000 MkII and RC-18SR universal remote
control.
# They should operate the following Marantz AV Receiver/Amp devices:
#
# SR9600, SR9300, SR9200, SR8500, SR8400, SR8300, SR8200, SR7500, SR7400,
SR7300
# SR7300OSE, SR7200, SR6400, SR6300, SR6200, SR5600, SR5500, SR5400, SR5300
# SR5200, SR4600, SR4500, SR4400, SR4300, SR4200, SR4320, PM-11S1, PM7001,
PM7200
#
# From
http://us.marantz.com/DocumentMaster/US/Marantz_RC_codes_All_AVR_Amp.zip
#
# Command codes listed by Marantz consist of groups of decimal numbers.
# Commands with 2 numbers (ie: command 16 12) are RC5 codes.
# Commands with 3 numbers (ie: command 16 12 01) are RC5x codes.
#
# Note: RC5x is not supported by LIRC (as of 0.9.0), so these codes are in
raw format.
#
# RC5x protocol: 3 pieces of data are sent - System(0-31), Command(0-127),
Data(0-63)
# Data sent is START, inverted MSB of Command, TOGGLE, System, PAUSE,
Command, Data
#
START,~C6,TOGGLE,S4,S3,S2,S1,S0,PAUSE,C5,C4,C3,C2,C1,C0,D5,D4,D3,D2,D1,D0
#
# EXAMPLE: For the Marantz code 16 12 01 (POWER ON)
# System = 16 (10000b)
# Command = 12 (0001100b)
# Data = 1 (000001b)
#
# START is always 1
# TOGGLE is always 0 (lircd toggles it automatically every
keypress)
# PAUSE is a gap of 2 bit times where no IR pulses are sent, it
is NOT two zeroes!
#
# So the resulting data is
1,1,0,1,0,0,0,0,PAUSE,0,0,1,1,0,0,0,0,0,0,0,1
# ~C6 T S4.....S0 C5.......C0
D5.......D0
#
# This bit sequence is what is encoded in the raw format below
(MSB first).
#
begin remote
name Marantz_RC2000
bits 13
flags RC5|CONST_LENGTH
eps 30
aeps 100
one 890 890
zero 890 890
plead 890 # This is the start bit!
gap 125000
toggle_bit 2 # toggle_mask 0x800?
frequency 36000
begin codes
POWER_ON/OFF 0x140C
VOL+ 0x1410
VOL- 0x1411
MUTE 0x140D
ATT 0x140D # (PM-11S1)
OK/OSD_Menu 0x0412 # OSD menu ON & OK
EXIT_MENU 0x0413 # Exit from OSD menu
ENTER 0x0417 # (PM-11S1)
CURSOR_Up 0x0410
CURSOR_Down 0x0411
CURSOR_Left 0x0415
CURSOR_Right 0x0416
# These are the "System Select" keys. They change which
# mode the Marantz system and the remote are in.
TUNER-1 0x147F # Tuner-1 or change BAND (>FM>AM>LW)
LINE1 0x147F # (PM-11S1)
CD 0x153F
TAPE 0x14BF
RECORDER2 0x14BF # (PM-11S1)
CD-R 0x16BF
RECORDER1 0x16BF # (PM-11S1)
MD 0x15FF
LD 0x133F
TV 0x103F
VCR1 0x117F
VCR2 0x11BF
DSS 0x123F
PHONO 0x157F
SURROUND_MODE 0x1425
SOURCE_DIRECT 0x1422
PURE_DIRECT 0x1422
SLEEP 0x1426 # Activate sleep timer (10 min. step)
OSD_Info 0x140F # OSD general information on/off
DISPLAY 0x140F # Front display on/off
# SR4320
SPEAKER_Sel 0x141D # Select Speaker (SPKR-A> SPKR-B> SPKR-A+B> SPKR-Off>)
SPEAKER-A_ON/OFF 0x1423
SPEAKER-B_ON/OFF 0x1427
# Tone controls
BASS+ 0x1416
BASS- 0x1417
TREBLE+ 0x1418
TREBLE- 0x1419
BALANCE_RIGHT 0x141A
BALANCE_LEFT 0x141B
BAND 0x147F # Select FM and AM (Toggle)
# Commands for Tuner-1 mode
Tuner-1_FM 0x146D
Tuner-1_AM 0x146E
Tuner-1_MEMO 0x1469 # Memory
Tuner-1_PRESET_SCAN 0x146B # Start Preset Scan
Tuner-1_PRESET_Up+ 0x1460 # Preset(Skip) up
Tuner-1_PREST_Down- 0x1461 # Preset(Skip) down
Tuner-1_FREQ_Up+ 0x145E # Frequency(Scan) up
Tuner-1_FREQ_Down- 0x145F # Frequency(Scan) down
Tuner-1_T-MODE 0x1465 # FM MODE (Auto Stereo / Mono)
Tuner-1_FREQ-DIRECT 0x144B # Change to Direct Frequency input mode
Tuner-1_0 0x1440
Tuner-1_1 0x1441
Tuner-1_2 0x1442
Tuner-1_3 0x1443
Tuner-1_4 0x1444
Tuner-1_5 0x1445
Tuner-1_6 0x1446
Tuner-1_7 0x1447
Tuner-1_8 0x1448
Tuner-1_9 0x1449
Tuner-1_CLEAR 0x147A
PRESET_INFO 0x0452 # Display the preset station OSD
DISPLAY_MODE 0x144F # Toggle display mode
PTY 0x1478 # Select Program Type for RDS
end codes
end remote
begin remote
name Marantz_RC2000x
flags RAW_CODES|CONST_LENGTH
eps 30
aeps 100
gap 125000
# one 890 890
# zero 890 890
# plead 890
# If the transmit PAUSE is 2 bits long, the toggle bit would be in this
position
# toggle_mask 0x080000
frequency 36000
begin raw_codes
# Command 16 12 01
name POWER_ON
890 890 1780 1780 1780 890
890 890 890 890 890 4450
890 890 890 1780 890 890
1780 890 890 890 890 890
890 890 890 890 890 890
890 1780 890
# Command 16 12 02
name POWER_OFF
890 890 1780 1780 1780 890
890 890 890 890 890 4450
890 890 890 1780 890 890
1780 890 890 890 890 890
890 890 890 890 890 1780
1780
# Command 16 00 10 - Select DVD mode (LINE2 - PM11S1)
name DVD
890 890 1780 1780 1780 890
890 890 890 890 890 4450
890 890 890 890 890 890
890 890 890 890 890 890
890 890 890 1780 1780 1780
1780
# Command 16 00 06 - Select AUX1 mode
Name AUX1
890 890 1780 1780 1780 890
890 890 890 890 890 4450
890 890 890 890 890 890
890 890 890 890 890 890
890 890 890 890 890 1780
890 890 1780
# To Do:
#
# 16 13 00 MUTE_ON
# 16 13 01 MUTE_OFF
# 16 00 13 INPUT_NEXT
# 16 00 14 INPUT_BACK
# 17 63 02 TUNER-2
# 16 00 07 AUX2
# 16 00 20 BALANCED
# 16 01 03 7.1(6.1)CH.Input_ON/OFF
# 16 01 12 7.1(6.1)CH.Input_ON
# 16 01 13 7.1(6.1)CH.Input_OFF
# 16 37 45 AUTO
# 16 37 30 STEREO
# 16 37 50 MULTI-CH_STEREO
# etc...
end raw_codes
end remote
|