Panasonic Remote Control IR codes in hex

I have a Panasonic Viera 42AS610 and I want to use an Arduino Mega 2560 for cloning the remote. :slight_smile:

I got the code from: RC: Panasonic HDTVs - Discrete Infrared Hex Codes :slight_smile:

Although this code may not work for my TV, I still want to try it.

As a newbie(got to know about arduino only 2 months ago) I do not know the pronto hex format.There are very good websites explaining them, I didn't understand even the head or tail of it. :confused:

I need help converting

0000 0071 0000 0032 0080 003f 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0030 0010 0a98

to a format like

[255, 136, 130, 34](Not exact code but copied from Building a Universal Remote with an Arduino)

Thank you for any help

GaganP:
I have a Panasonic Viera 42AS610 and I want to use an Arduino Mega 2560 for cloning the remote. :slight_smile:

I got the code from: RC: Panasonic HDTVs - Discrete Infrared Hex Codes :slight_smile:

Although this code may not work for my TV, I still want to try it.

As a newbie(got to know about arduino only 2 months ago) I do not know the pronto hex format.There are very good websites explaining them, I didn't understand even the head or tail of it. :confused:

I need help converting

0000 0071 0000 0032 0080 003f 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0010 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0030 0010 0010 0010 0030 0010 0a98

to a format like

[255, 136, 130, 34](Not exact code but copied from Building a Universal Remote with an Arduino)

Thank you for any help

Gee... nobody answered you?

I'm working on an IR remote project and can probably help you out.

The data file in your quote consists of pulse counts of IR energy to make up a remote code.

An IR remote command is usually:

(1) A header - a long burst of IR pulses used solely to set the AGC of the IR receiver on the TV
(2) A "Mark" pulse, consisting of enough IR pulses (at 38 or 40 khz) to last around 1200 milliseconds.
(3) A "Space" pulse consisting of enough IR pulses to last around 600 milliseconds (i.e. 1/2 of a Mark).

Note: A header is usually twice as long as a Mark.

Next, the data is encoded bit for bit. A Mark-Space (that is, Long-Short) means binary "1" and a Space-Space (short-short) means binary "0".

Some devices (like Panasonic HA HA!) use both an address and a data packet in the command. So, let's decode your data above and see what it says:

  • The first 4 numbers look like junk.
  • The 80, 3F is probably the Header.
  • Now, let's see what we have:
[b]0080 003f - header

0010 0010 - 0 4
0010 0010 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 4
0010 0010 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 1
0010 0010 - 0
0010 0010 - 0
0010 0010 - 1

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

0010 0010 - 1 F
0010 0010 - 1
0010 0010 - 1
0010 0010 - 1

0010 0010 - 1 C
0010 0010 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 1 F
0010 0010 - 1
0010 0010 - 1
0010 0010 - 1

0010 0010 - 1 D
0010 0010 - 1
0010 0010 - 0
0010 0010 - 1

0010 0a98 - junk at the end

[/b]

So, you see? The data consists of a 16 bit address [b]0x4004[/b] and a 32 bit command of [b]0x0100FCFD[/b].

Lastly, the numbers themselves are cycle counts (at 40 khz probably). At 40 khz, each cycle is 25 microseconds (1/40khz). So the pulse widths are:

Header = 0x80 = 128, 128 * 25 = 3200 microseconds
Header 0x3F = 63, 63 * 25 = 1575 (most probably supposed to be 0x40, 1600 microseconds)
Mark bit = 0x10 = 16, 16 * 25 = 400 microseconds
Data Mark = 0x30 = 48, 48 * 25 = 1200 microseconds
Data Space = 0x10 = 16, 16 * 25 = 400 microseconds

Now, realize that those timings were probably obtained by someone's IR analyzer and could be a little bit off. USUALLY you will find that headers, marks, spaces, etc... are all integer multiples of the carrier frequency. In fact, I KNOW for sure that Panasonic uses 500 microseconds for the Mark bit, not 400, so it's probably an error on the part of the person taking the data.

Great, so now what do you DO with all of this? Well, take a look at the source from my IR transmitter. It uses a timer interrupt to generate the 40 khz and another interrupt to allow the processor to sleep, then wake up when the button is pressed, send out the IR code, then go back to sleep (i.e. no power switch needed).

This should be enough to get you started. Note that this code is for an ATTiny processor, so if you want to use it on a 328P (Uno) or a Mega2560, you will have to change a few register names and/or bits as required... but at least it's a starting point. In fact, so this message board doesn't prohibit me from posting so much text, I'll put the source in the next post.

GaganP:
I have a Panasonic Viera 42AS610 and I want to use an Arduino Mega 2560 for cloning the remote. :slight_smile:

OK here it is:

///////////////////////////////////////////////////////////////////////////////
//
//  Infrared Remote Control for Panasonic Plasma TV
//  Copyright (c) 2015 Roger A. Krupski <rakrupski@verizon.net>
//
//  Last update: 16 September 2015
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////////

#define F_CPU 8000000UL

#include <inttypes.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/power.h>
#include <avr/pgmspace.h>
#include <util/delay.h> // for _delay_xs

// ATtiny25 fuse settings:
//  H-fuse: 0xDF (SPI enabled, BOD disabled)
//  L-fuse: 0xFF (external crystal)
//  E-fuse: 0xFF (self program enabled)

#define IO_PORT PORTB // (port write)
#define IO_PIN  PINB  // (port read)
#define IO_DDR  DDRB  // (port ddr)
#define IR_BIT  PB0   // 2N4401 base drive for IR LED (thru 150 ohm resistor)
#define MODE    PB1   // select mode: (currently unused) (has external 10K pullup)
#define BUTTON  PB2   // send IR code (red button - active low - external 10K pullup)
#define KHZ     40    // IR carrier freq

volatile uint8_t count = 0; // led pulse counter
volatile uint8_t state = 0; // led on/off state
volatile uint8_t onoff = 0; // pulse polarity

// Panasonic TV power toggle
static const uint8_t panapower[] PROGMEM = {
	// header
	0x7e, 0x3f,
	// address
	0x12, 0x0e, 0x12, 0x2a, 0x12, 0x0e, 0x12, 0x0e, // 4
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, // 0
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, // 0
	0x12, 0x0e, 0x12, 0x2a, 0x12, 0x0e, 0x12, 0x0e, // 4
	// command
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, // 0
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x2a, // 1
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, // 0
	0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, 0x12, 0x0e, // 0
	0x12, 0x2a, 0x12, 0x0e, 0x12, 0x2a, 0x12, 0x2a, // B
	0x12, 0x2a, 0x12, 0x2a, 0x12, 0x0e, 0x12, 0x0e, // C
	0x12, 0x2a, 0x12, 0x0e, 0x12, 0x2a, 0x12, 0x2a, // B
	0x12, 0x2a, 0x12, 0x2a, 0x12, 0x0e, 0x12, 0x2a, // D
	// footer
	0x12, 0x0e,
	// end of command
	0x00,
};

void send_cmd (const uint8_t *cmd, uint8_t rpt, uint8_t dly)
{
	uint8_t x;
	IO_DDR |= _BV (IR_BIT);  // IR drive pin is an output
	state = 0; // insure state starts correctly
	while (rpt--) {
		x = 0; // start PROGMEM address offset
		do { // each one is a pulse count at 40 khz
			while (count); // wait until ISR is done sending pulses
			count = pgm_read_byte (cmd + x++); // set next pulse count
			onoff = (x % 2); // set which side is high
		} while (count); // until we hit 0x00 (end of command)
		_delay_ms (dly); // delay between commands
	}
	IO_DDR &= ~_BV (IR_BIT);  // turn off IR drive pin
}

ISR (TIMER0_COMPA_vect)
{
	if (count) { // if a count was pushed in...
		// if LED is on then turn it off
		// turn it on, or leave it off, depending on the state of "onoff"
		state ? IO_PORT &= ~_BV (IR_BIT) : onoff ? IO_PORT |= _BV (IR_BIT) : IO_PORT &= ~_BV (IR_BIT);
		// decrement count (on times only)
		count-= state;
		// toggle LED on/off state
		state ? state = 0 : state = 1;
	}
}

ISR (INT0_vect) // INT0 handler - we arrive here when the button is pressed
{
	GIMSK &= ~_BV (INT0); // disable hardware INT0
	cli (); // ignore further interrupts
}

int main (void)
{
	uint8_t deb;

	cli (); // disable interrupts while setting stuff

	IO_PORT &= ~(_BV (IR_BIT) | _BV (MODE) | _BV (BUTTON)); // set all ports low
	IO_DDR &= ~(_BV (MODE) |_BV (BUTTON)); // set port DDR to inputs

	ADCSRA &= ~_BV (ADEN); // turn off ADC

	sleep_bod_disable (); // turn off brown-out detector
	set_sleep_mode (SLEEP_MODE_PWR_DOWN); // set CPU to go into power down mode

	MCUCR &= ~(_BV (ISC01) | _BV (ISC00)); // set hardware INT0 active on low level

	sleep_enable (); // enable CPU to be powered down

	// set timer 0 (8 bit) to CTC mode, 40 khz.
	// this generates the IR pulses
	TCCR0A = _BV (WGM01); // mode 2 (CTC) OCR0A = top
	TCCR0B = _BV (CS00); // F_CPU/1 = 8000000
	OCR0A  = ((F_CPU/2000/KHZ)-1); // divider for IR carrier freq 40 khz.
	TIMSK  = _BV (OCIE0A); // enable interrupt on OCR0A match

	while (1) {
		GIMSK |= _BV (INT0); // enable INT0 active low
		sei (); // enable interrupts so cpu can recognize pushbutton INT
		sleep_cpu (); // power down cpu (all clocks stopped)
		// cpu is now asleep - we are waiting for INT0...
		// ...we are here when the button is pushed
		sei (); // enable interrupts (coming out of sleep disabled them)
		deb = 200; // init debounce
		while (deb--) {
			_delay_us (50); // 50 us delay
			if (IO_PIN & _BV (BUTTON)) { // if button bounced...
				deb = 200; // ...reset debounce
			}
		} // now button has been bounce-free for 10000 usec (10 msec)
		// now send IR command and go back to sleep
		send_cmd (0, 1, 1); // command offset 0, send it once, delay unused
		deb = 200; // init debounce
		while (deb--) {
			_delay_us (50); // 50 us delay
			if (! (IO_PIN & _BV (BUTTON))) { // if button bounced...
				deb = 200; // ...reset debounce
			}
		} // now button has been bounce-free for 10000 usec (10 msec)
	}
}

Feeling a bit overwhelmed? :slight_smile:

Very Sorry for my vvveeerrryyy late reply, Thanks a lot. Now I finally understand it. I thought no one had replied because i do not check my mail often. :relaxed:

Actually I finally gave up a week after I had posted the question. But now i am thinking to revive the project. Any errors, I will start a new topic. So, think of this post as solved!!!!!

Thank You

Krupski,

How do you get this...? 04 for 0010 0010 and 0 for 0010 0010? What am I missing?

0010 0010 - 0 4
0010 0010 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

Was this what you wanted to typ?

0010 0010 - 0 4
0010 0030 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0
...........................
.........................

0010 0030 - 1 F
0010 0030 - 1
0010 0030 - 1
0010 0030 - 1

0010 0030 - 1 D
0010 0030 - 1
0010 0010 - 0
0010 0030 - 1

purza:
Krupski,

How do you get this...? 04 for 0010 0010 and 0 for 0010 0010? What am I missing?

0010 0010 - 0 4
0010 0010 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0

Was this what you wanted to typ?

0010 0010 - 0 4
0010 0030 - 1
0010 0010 - 0
0010 0010 - 0

0010 0010 - 0 0
0010 0010 - 0
0010 0010 - 0
0010 0010 - 0
...........................
.........................

0010 0030 - 1 F
0010 0030 - 1
0010 0030 - 1
0010 0030 - 1

0010 0030 - 1 D
0010 0030 - 1
0010 0010 - 0
0010 0030 - 1

0010 0010 represents bit 0
0010 0030 represents bit 1
When you see the first block, you get 0100 in binary and it is 4 in decimal. Similarly, second block is 0000 (0) and etc.