Hjälp att fatta AVR kod!

PIC, AVR, Arduino, Raspberry Pi, Basic Stamp, PLC mm.
Användarvisningsbild
ElectricMan
Inlägg: 4874
Blev medlem: 21 februari 2007, 20:22:48
Skype: ElectricManSwe
Ort: Luleå
Kontakt:

Hjälp att fatta AVR kod!

Inlägg av ElectricMan »

Jag har hittat en kod för TV-B gone för en AVR (här). Dock har jag ingen AVR programmerare eller så. Då kom jag att tänka på om man kan konvertera den till Arduino språket som jag fattar!


Detta är vad jag skulle vilja ha hjälp med att fatta främst:

Kod: Markera allt

// Code 000 -- Sony, Baur, Neckermann, Otto Versand, Palladium, Quelle, SEI, Sinudyne, Sonolor, Universum
const struct powercode sonyCode PROGMEM = {
  freq_to_timerval(37470), // 37.47 KHz  
  {{245, 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {61 , 60},
   {61 , 2759},
   {245, 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {61 , 60},
   {61 , 0}// end of code
  }
};
Detta är alltså "koden" för att stänga av tex. Sony TV apparater.
Vad jag inte fattar är vad alla siffrorna gör? Är det "delays" på något sätt? Siffrorna är i par, det finns 2st lysdioder. Betyder det att tex. första raden är LED1 på i 245 ms (eller är det ens ms?) och LED2 på i 60 ms?

HJÄLP! :D
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: Hjälp att fatta AVR kod!

Inlägg av sodjan »

Siffrorna kan ju betyda exakt vad som helst, och det går bara
att svara på genom att kolla där de faktiskt *används*. Det
du har visat är bara en strukt med en massa värden...
Användarvisningsbild
ElectricMan
Inlägg: 4874
Blev medlem: 21 februari 2007, 20:22:48
Skype: ElectricManSwe
Ort: Luleå
Kontakt:

Re: Hjälp att fatta AVR kod!

Inlägg av ElectricMan »

Aha :D

Här är den "rikriga" koden:

Kod: Markera allt

/*
TV-B-Gone
Firmware
for use with ATtiny85
Mitch Altman + Limor Fried
7-Oct-07

Distributed under Creative Commons 2.5 -- Attib & Share Alike
*/

#include <avr/io.h>             // this contains all the IO port definitions
#include <avr/interrupt.h>      // definitions for interrupts
#include <avr/sleep.h>          // definitions for power-down modes
#include <avr/pgmspace.h>       // definitions or keeping constants in program memory
#include "main.h"

#define LED PB2         //  visible LED
#define IRLED1 PB0      //  IR LED
#define IRLED2 PB1      //  IR LED

/*
This project transmits a bunch of TV POWER codes, one right after the other, 
with a pause in between each.  (To have a visible indication that it is 
transmitting, it also pulses a visible LED once each time a POWER code is 
transmitted.)  That is all TV-B-Gone does.  The tricky part of TV-B-Gone 
was collecting all of the POWER codes, and getting rid of the duplicates and 
near-duplicates (because if there is a duplicate, then one POWER code will 
turn a TV off, and the duplicate will turn it on again (which we certainly 
do not want).  I have compiled the top-40 most popular codes with the 
duplicates eliminated, both for North America (which is the same as Asia, as 
far as POWER codes are concerned -- even though much of Asia USES PAL video) 
and for Europe (which works for Australia, New Zealand, the Middle East, and 
other parts of the world that use PAL video).

Before creating a TV-B-Gone Kit, I originally started this project by hacking 
the MiniPOV kit.  This presents a limitation, based on the size of
the Atmel ATtiny2313 internal flash memory, which is 2KB.  With 2KB we can only 
fit about 7 POWER codes into the firmware's database of POWER codes.  40 codes
requires 8KB of flash memory, which is why we chose the ATtiny85 for the 
TV-B-Gone Kit.

This version of the firmware has the most popular 40 POWER codes for North America.
*/


/*
This project is a good example of how to use the AVR chip timers.
*/


/*
The hardware for this project is very simple:
     ATtiny85 has 8 pins:
       pin 1   connects to programming circuitry
       pin 2   one pin of ceramic resonator
       pin 3   one pin of ceramic resonator
       pin 4   ground
       pin 5   PB0 - visible LED, and also connects to programming circuitry
       pin 6   OC1A - IR emitter, through a PN2222A driver (with 47 ohm base resistor), and also connects to programming circuitry
       pin 7   push-button switch, and also connects to serial port programming circuitry
       pin 8   +3v
    See the schematic for more details.

    This firmware requires using an 8.0MHz ceramic resonator 
       (since the internal oscillator may not be accurate enough).

    IMPORTANT:  to use the ceramic resonator, you must perform the following:
                    make burn-fuse_cr
*/


/*
The C compiler creates code that will transfer all constants into RAM when the microcontroller
resets.  Since this firmware has a table (powerCodes) that is too large to transfer into RAM,
the C compiler needs to be told to keep it in program memory space.  This is accomplished by
the macro PROGMEM (this is used in the definition for powerCodes).  Since the
C compiler assumes that constants are in RAM, rather than in program memory, when accessing
powerCodes, we need to use the pgm_read_word() and pgm_read_byte macros, and we need
to use powerCodes as an address.  This is done with PGM_P, defined below.  
For example, when we start a new powerCode, we first point to it with the following statement:
    PGM_P thecode_p = pgm_read_word(powerCodes+i);
The next read from the powerCode is a byte that indicates the carrier frequency, read as follows:
    uint8_t freq = pgm_read_byte(thecode_p);
Subsequent reads from the powerCode are onTime/offTime pairs, which are words, read as follows:
    ontime = pgm_read_word(thecode_p+(offset_into_table);
    offtime = pgm_read_word(thecode_p+(offset_into_table);
*/

#define NOP __asm__ __volatile__ ("nop")
// This function delays the specified number of 10 microseconds
#define DELAY_CNT 11
void delay_ten_us(uint16_t us) {
  uint8_t timer;
  while (us != 0) {
    for (timer=0; timer <= DELAY_CNT; timer++) {
      NOP;
      NOP;
    }
    NOP;
    us--;
  }
}


// This function quickly pulses the visible LED (connected to PB0, pin 5)
void quickflashLED( void ) {
  // pulse LED on for 30ms

  PORTB &= ~_BV(LED);         // turn on visible LED at PB0 by pulling pin to ground
  delay_ten_us(3000);         // 30 millisec delay
  PORTB |= _BV(LED);          // turn off visible LED at PB0 by pulling pin to +3V
}


// This function quickly pulses the visible LED (connected to PB0, pin 5) 4 times
void quickflashLED4x( void ) {
  quickflashLED();
  delay_ten_us(15000);        // 150 millisec delay
  quickflashLED();
  delay_ten_us(15000);        // 150 millisec delay
  quickflashLED();
  delay_ten_us(15000);        // 150 millisec delay
  quickflashLED();
}


// This function transmits one Code Element of a POWER code to the IR emitter, 
//   given offTime and onTime for the codeElement
//     If offTime = 0 that signifies the last Code Element of the POWER code
//     and the delay_ten_us function will have no delay for offTime 
//     (but we'll delay for 250 milliseconds in the main function)
void xmitCodeElement(uint16_t ontime, uint16_t offtime ) {
  // start Timer1 outputting the carrier frequency to IR emitters on OC1A (PB1, pin 6) and OC0A (PB0, pin 5)
  TCNT0 = 0; // reset the timers so they are aligned
  TCNT1 = 0;
  TIFR = 0;  // clean out the timer flags

  TCCR0A =_BV(COM0A0) | _BV(WGM01);          // set up timer 0

  TCCR1 =_BV(COM1A0) | _BV(CS10) | _BV(CTC1);      // set up and turn on timer 1
  //TCCR1 = 0b10010001  // CTC1 = 1 to reset Timer1 to 0 when it reaches the value in OCR1C (i.e., on Compare Match)
                        // PWM1A = 0 to disable PWM mode
                        // COM1A1:0 = 01 to toggle OC1A on Compare Match
                        // CS13:10 = 0001 to start Timer1 with prescaler set to divide by 1 (i.e., no prescaler divide)
  TCCR0B = _BV(CS00);                              // turn on timer 0 exactly 1 instruction later

  // keep transmitting carrier for onTime
  delay_ten_us(ontime);

  
  // turn off output to IR emitters on 0C1A (PB1, pin 6) for offTime
  TCCR1 = 0;      // stop Timer 1
  TCCR0B = 0;     // stop Timer 0, exactly one instruction later
  TCCR0A = 0;

  PORTB &= ~_BV(IRLED1) & ~_BV(IRLED2);           // turn off IR LED

  delay_ten_us(offtime);
}

//extern const struct powercode powerCodes[] PROGMEM;
extern const PGM_P *powerCodes[] PROGMEM;

extern uint8_t num_codes;

int main(void) {
  uint8_t i, j;
  uint16_t ontime, offtime;

  DDRB = _BV(LED) | _BV(IRLED1) | _BV(IRLED2);    // set the visible and IR LED pins to outputs
  PORTB = _BV(LED);  //  visible LED is off when pin is high
  PORTB &= ~_BV(IRLED1) & ~_BV(IRLED2);        // IR LED is off when pin is low

  for (i=0; i<num_codes; i++) {   // for every POWER code in our collection
    quickflashLED(); // visible indication that a code is being output
    PGM_P thecode_p = pgm_read_word(powerCodes+i);     // point to next POWER code

    uint8_t freq = pgm_read_byte(thecode_p);
    // set OCR for Timer1 and Timer0 to output this POWER code's carrier frequency
    OCR0A = OCR1C = freq; 
    
    // transmit all codeElements for this POWER code (a codeElement is an onTime and an offTime)
    // transmitting onTime means pulsing the IR emitters at the carrier frequency for the length of time specified in onTime
    // transmitting offTime means no output from the IR emitters for the length of time specified in offTime
    j = 0;  // index into codeElements of this POWER code
    do {
      // read the onTime and offTime from the program memory
      ontime = pgm_read_word(thecode_p+(j*4)+1);
      offtime = pgm_read_word(thecode_p+(j*4)+3);

      xmitCodeElement(ontime, offtime);  // transmit this codeElement (ontime and offtime)
      j++;
    } while ( offtime != 0 );  // offTime = 0 signifies last codeElement for a POWER code

    PORTB &= ~_BV(IRLED1) & ~_BV(IRLED2);           // turn off IR LED

    // delay 250 milliseconds before transmitting next POWER code
    delay_ten_us(25000);
  }
  

  // flash the visible LED on PB0  4 times to indicate that we're done
  delay_ten_us(65500); // wait maxtime 
  quickflashLED4x();

  // Shut down everything and put the CPU to sleep
  TCCR1 = 0;                      // turn off frequency generator (should be off already)
  TCCR0B = 0;
  PORTB |= _BV(LED); // turn on the button pullup, turn off visible LED
  PORTB &= ~_BV(IRLED1) & ~_BV(IRLED2);           // turn off IR LED
  delay_ten_us(1000);             // wait 10 millisec second

  MCUCR = _BV(SM1) |  _BV(SE);    // power down mode,  SE=1 (bit 5) -- enables Sleep Modes
  sleep_cpu();                    // put CPU inteo Power Down Sleep Mode
}

Edit:

Här är hela "kod koden"

Kod: Markera allt

#include <avr/io.h>             // this contains all the IO port definitions
#include <avr/pgmspace.h>       // definitions or keeping constants in program memory
#include "main.h"

// table of POWER codes

#define freq_to_timerval(x) ((F_CPU / x - 1 )/ 2)

  
// Code 000 -- Sony, Baur, Neckermann, Otto Versand, Palladium, Quelle, SEI, Sinudyne, Sonolor, Universum
const struct powercode sonyCode PROGMEM = {
  freq_to_timerval(37470), // 37.47 KHz  
  {{245, 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {61 , 60},
   {61 , 2759},
   {245, 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {123, 60},
   {61 , 60},
   {61 , 60},
   {61 , 60},
   {61 , 0}// end of code
  }
};

//Code 001 - Proscan, RCA, Curtis Mathes, Dimensia, GE, JC Penney, LXI, Radio Shack/Realistic, Sears, Wards
const struct powercode rcaCode PROGMEM = {
  freq_to_timerval(55600), // 55.6 KHz  
  {{ 411,   410 },
   {  52,   205 },
   {  52,   205 },
   {  52,   205 },
   {  52,   205 },
   {  52,   102 },
   {  52,   102 },
   {  52,   205 },
   {  52,   102 },
   {  52,   205 },
   {  52,   102 },
   {  52,   205 },
   {  52,   102 },
   {  52,   102 },
   {  52,   102 },
   {  52,   102 },
   {  52,   102 },
   {  52,   205 },
   {  52,   205 },
   {  52,   102 },
   {  52,   205 },
   {  52,   102 },
   {  52,   205 },
   {  52,   102 },
   {  52,   205 },
   {  52,   821 },
   { 411,   410},
   {  52,   205},
   {  52,   205},
   {  52,   205},
   {  52,   205},
   {  52,   102},
   {  52,   102},
   {  52,   205},
   {  52,   102},
   {  52,   205},
   {  52,   102},
   {  52,   205},
   {  52,   102},
   {  52,   102},
   {  52,   102},
   {  52,   102},
   {  52,   102},
   {  52,   205},
   {  52,   205},
   {  52,   102},
   {  52,   205},
   {  52,   102},
   {  52,   205},
   {  52,   102},
   {  52,   205},
   {  52,   0}
  }
};

// Code 002 -- Panasonic
const struct powercode panasonicCode PROGMEM = {
  freq_to_timerval(36130), // 36.13 KHz
  {{ 358,   179 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,  7720 },
   { 358,   180 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,    45 },
   {  44,    45 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,   135 },
   {  44,    45 },
   {  44,   135 },
   {  44,     0 }}
};

// Code 003 -- Sharp
const struct powercode sharpCode PROGMEM = {
  freq_to_timerval( 37470), // 37.47 KHz
  {{  28,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,  4670 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,   189 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,  4670 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,  4670 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,    81 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,   189 },
   {  29,   189 },
   {  29,    81 },
   {  29,   189 },
   {  29,     0 }}
};

// Code 004 -- Toshiba, Apex
const struct powercode toshibaCode PROGMEM = {
  freq_to_timerval( 37470), // 37.47 KHz
  {{ 924,   464 },
   {  58,    57 },
   {  58,    57 },
   {  58,    57 },
   {  58,    57 },
   {  58,    57 },
   {  58,    57 },
   {  58,   173 },
   {  58,    57 },
   {  58,   173 },
   {  58,   173 },
   {  58,   173 },
   {  58,   173 },
   {  58,   173 },
   {  58,   173 },
   {  58,    57 },
   {  58,   173 },
   {  58,    57 },
   {  58,   173 },
   {  58,    57 },
   {  58,    57 },
   {  58,   173 },
   {  58,    57 },
   {  58,    57 },
   {  58,    57 },
   {  58,   173 },
   {  58,    57 },
   {  58,   173 },
   {  58,   173 },
   {  58,    57 },
   {  58,   173 },
   {  58,   173 },
   {  58,   173 },
   {  58,  4054 },
   { 926,   230 },
   {  58,  9880 },
   { 926,   230 },
   {  58,     0 },						       
  }
};

// Code 005 -- Philips, Grundig, Pye
const struct powercode philipsCode PROGMEM = {
  freq_to_timerval( 34800), // 37.47 KHz
  {  {  92,    92 },
     { 184,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,   184 },
     {  92,    92 },
     { 184,    92 },
     {  92,  9216 },
     {  92,    92 },
     { 184,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,    92 },
     {  92,   184 },
     {  92,    92 },
     { 184,    92 },
     {  92,     0 },
  }
};

// Code 006 -- Samsung
const struct powercode samsungCode PROGMEM = {
  freq_to_timerval( 37470), // 37.47 KHz
  {{ 462,   476 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,    62 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,  4661 },
   { 464,   476 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,    62 },
   {  53,   175 },
   {  53,    62 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,   175 },
   {  53,     0 },
  }
};

// Code 007 -- Zenith
const struct powercode zenithCode PROGMEM = {
  freq_to_timerval( 38200), 
  {{  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,   522 },
   {  52,    49 },
   {  52, 12433 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,    49 },
   {  52,   419 },
   {  52,   522 },
   {  52,   522 },
   {  52,    49 },
   {  52,     0 },
  }
};

// Code 008 --Pioneer, Sansui, Toshiba
const struct powercode pioneerCode PROGMEM = {
  freq_to_timerval( 37470), 
  {{924,  462},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59, 4117},
   {926,  459},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,  173},
   { 59,   59},
   { 59,  173},
   { 59,    0}}
};

// Code 009 -- Sylvania
const struct powercode sylvaniaCode PROGMEM = {
  freq_to_timerval( 37430), 
  {{924, 461},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 174},
   {56, 56},
   {56, 174},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 174},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 174},
   {56, 56},
   {56, 56},
   {56, 56},
   {56, 4055},
   {926, 230},
   {56, 9855},
   {926, 230},
   {56, 0}
  }
};

// Code 010 -- JVC
const struct powercode jvcCode PROGMEM = {
  freq_to_timerval( 37470), 
  { {865,	429},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	161},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	2347},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	161},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	2347},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	161},
    {53,	161},
    {53,	161},
    {53,	55},
    {53,	161},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	0}}
};

// Code 011 -- Hitachi
const struct powercode hitachiCode PROGMEM = {
  freq_to_timerval( 37470), 
  { {909,	452},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	175},
    {58,	175},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	175},
    {58,	175},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	55},
    {58,	175},
    {58,	55},
    {58,	175},
    {58,	175},
    {58,	175},
    {58,	4146},
    {910,	229},
    {58,	9597},
    {910,	229},
    {56,	0} }
};

// Code 012 -- Sampo
const struct powercode sampoCode PROGMEM = {
  freq_to_timerval( 37470), 
  { {342,	343},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	260},
    {85,	3366},
    {342,	344},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	87},
    {85,	87},
    {85,	260},
    {85,	260},
    {85,	260},
    {85,	0}}
};

// Code 013 -- Hisense
const struct powercode hisenseCode PROGMEM = {
  freq_to_timerval( 37520), 
  { {918,	459},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	170},
    {56,	55},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	55},
    {56,	55},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	55},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	170},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	170},
    {56,	170},
    {56,	55},
    {56,	170},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	55},
    {56,	55},
    {56,	55},
    {56,	170},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	55},
    {56,	170},
    {56,	170},
    {56,	170},
    {56,	2364},
    {920,	458},
    {56,	9620},
    {920,	458},
    {56,	0}}
};

// Code 014 -- Viewsonic, Acer
const struct powercode viewsonicCode PROGMEM = {
  freq_to_timerval( 37470), 
  { {924,	464},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	4054},
    {926,	230},
    {58,	9880},
    {926,	230},
    {58,	0}}
};

// Code 015 -- Bush, NET-TV
const struct powercode bushCode PROGMEM = {
  freq_to_timerval( 37470), 
  { {924,	464},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	4054},
    {926,	230},
    {58,	9880},
    {926,	230},
    {58,	0}}
};

// Code 016 -- AOC, Daewoo, Goldstar, JC Penney, LG, Memorex, MGA, 
// Mistubishi, MTC, NEC, Philco, Portland, RCA, Samsung, 
// Teknika, Vidtech, Wards, Yamaha
const struct powercode aocCode PROGMEM = {
  freq_to_timerval(33600), 
  { {30,	215},
    {30,	216},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	2573},
    {30,	216},
    {30,	216},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	216},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	91},
    {30,	0}}
};

// Code 017 -- Bell & Howell, Curtis Mathes, Emerson, Fisher, LXI, Memorex, 
// Radio Shack, Realistic, Sanyo, Sears, Toshiba
const struct powercode bellCode PROGMEM = {
  freq_to_timerval(38970), 
  { {924,	459},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	178},
    {59,	4260},
    {924,	231},
    {59,	9753},
    {924,	231},
    {59,	0}}
};

// Code 018 -- Pioneer, Hitachi
const struct powercode pioneer2Code PROGMEM = {
  freq_to_timerval(37470),
  { {873,	439},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	164},
    {53,	2633},
    {873,	440},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	164},
    {53,	2633},
    {873,	440},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	164},
    {53,	55},
    {53,	55},
    {53,	55},
    {53,	164},
    {53,	0}}
};

// Code 019 -- Fujitsu
const struct powercode fujitsuCode PROGMEM = {
  freq_to_timerval(37470),
  { {335,	166},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	4723},
    {336,	166},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	126},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	42},
    {43,	0}}
};


// Code 020 - Gold Star, JC Penney, LXI, Marantz, Memorex, Proton, Pulsar, 
// Toshiba, Wards

const struct powercode goldstarCode PROGMEM = {
  freq_to_timerval(37470),
  { {924,	472},
    {63,	55},
    {63,	55},
    {63,	166},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	166},
    {63,	166},
    {63,	55},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	166},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	55},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	55},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	166},
    {63,	4207},
    {926,	234},
    {63,	9957},
    {926,	234},
    {62,	0}}
};


// Code 021 - Daewoo, Emerson, Hitachi, RCA, White Westinghouse, Zenith
const struct powercode daewooCode PROGMEM = {
  freq_to_timerval(37470),
  { {821,	409},
    {51,	52},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	52},
    {51,	52},
    {51,	409},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	52},
    {51,	52},
    {51,	2397},
    {822,	409},
    {51,	52},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	52},
    {51,	52},
    {51,	409},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	163},
    {51,	52},
    {51,	52},
    {51,	52},
    {51,	0}}
};


// Code 022 - NEC
const struct powercode NECCode PROGMEM = {
  freq_to_timerval(37470),
  {
    {918,	460},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	179},
    {56,	179},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	179},
    {56,	179},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	61},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	179},
    {56,	61},
    {56,	61},
    {56,	4581},
    {921,	230},
    {56,	9705},
    {921,	230},
    {56,	0}
  }
};

// Code 023 - Admiral, Bell & Howell, Logik, Majestic, Memorex, 
// Montgomery Ward, Signature, Teknika, Wards, Zenith
const struct powercode admiralCode PROGMEM = {
  freq_to_timerval(39010),
  {
    {51,	516},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	10746},
    {51,	516},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	52},
    {51,	418},
    {51,	516},
    {51,	52},
    {51,	418},
    {51,	0}  }
};
// Code 024 - Sony
const struct powercode sony2Code PROGMEM = {
  freq_to_timerval(37470),
  { {245,	60},
    {123,	60},
    {123,	60},
    {123,	60},
    {123,	60},
    {61,	60},
    {123,	60},
    {61,	60},
    {123,	60},
    {61,	60},
    {61,	60},
    {61,	60},
    {61,	2636},
    {246,	60},
    {123,	60},
    {123,	60},
    {123,	60},
    {123,	60},
    {61,	60},
    {123,	60},
    {61,	60},
    {123,	60},
    {61,	60},
    {61,	60},
    {61,	60},
    {61,	0}  }
};

// Code 025 - Viewsonic, Magnavox, NET-TV, Electrograph, Gateway, Maxent, 
// NetTV, Sampo

const struct powercode viewsonic2Code PROGMEM = {
  freq_to_timerval(37470),
  {  {357,	358},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	3562},
    {358,	358},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	91},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	270},
    {88,	0},
  }
};


// Code 026 - Zenith
const struct powercode zenith2Code PROGMEM = {
  freq_to_timerval(38200),
  { {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	12922},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	419},
    {52,	522},
    {52,	49},
    {52,	0}}
};


// Code 027 - Thompson
const struct powercode thompsonCode PROGMEM = {
  freq_to_timerval(55600),
  { {411,	410},
    {52,	102},
    {52,	205},
    {52,	205},
    {52,	205},
    {52,	102},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	102},
    {52,	102},
    {52,	205},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	821},
    {411,	410},
    {52,	102},
    {52,	205},
    {52,	205},
    {52,	205},
    {52,	102},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	102},
    {52,	102},
    {52,	205},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {52,	102},
    {52,	205},
    {51,	0}}
};

// Code 028  - Brillian, Sears
const struct powercode brillianCode PROGMEM = {
  freq_to_timerval(37430),
  { {267,	276},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	277},
    {123,	123},
    {123,	123},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	4876},
    {267,	277},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	277},
    {123,	123},
    {123,	123},
    {123,	123},
    {123,	277},
    {123,	123},
    {123,	277},
    {123,	0}}
};
// Code 029 - Magnavox
const struct powercode magnavoxCode PROGMEM = {
  freq_to_timerval(34800),
  { {92,	92},
    {184,	92},
    {92,	92},
    {92,	92},
    {92,	92},
    {92,	92},
    {92,	184},
    {184,	92},
    {92,	184},
    {92,	92},
    {184,	9216},
    {92,	92},
    {184,	92},
    {92,	92},
    {92,	92},
    {92,	92},
    {92,	92},
    {92,	184},
    {184,	92},
    {92,	184},
    {92,	92},
    {184,	0}}
};

// Code 030 - Viewsonic
const struct powercode viewsonic3Code PROGMEM = {
  freq_to_timerval(37470),
  { {924,	461},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	4055},
    {926,	230},
    {56,	9855},
    {926,	230},
    {56,	0}}
};

// Code 031 - Crown, Infinity, JBL, Loewe, LXI, Magnavox, Marantz, 
// Panaxonic, Philco, Philips, Sylvania, Wards
const struct powercode crownCode PROGMEM = {
  freq_to_timerval(34800),
  { {92,	91},
    {92,	91},
    {184,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	182},
    {92,	91},
    {184,	91},
    {92,	9217},
    {92,	91},
    {92,	91},
    {184,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	91},
    {92,	182},
    {92,	91},
    {184,	91},
    {92,	0}}
};

// Code 032 - Hitachi
const struct powercode hitachi2Code PROGMEM = {
  freq_to_timerval(37470),
  { {924,	461},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	56},
    {56,	174},
    {56,	56},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	174},
    {56,	4055},
    {926,	230},
    {56,	9855},
    {926,	230},
    {56,	0} }
};

// Code 033 - Fujitsu
const struct powercode fujitsu2Code PROGMEM = {
  freq_to_timerval(37470),
  { {344,	159},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	5438},
    {347,	157},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	124},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	43},
    {43,	0}}
};


// Code 034 - Hitachi
const struct powercode hitachi3Code PROGMEM = {
  freq_to_timerval(37470),
  { {924,	464},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	4054},
    {925,	230},
    {58,	9880},
    {925,	230},
    {58,	0}}
};


// Code 035 - NEC
const struct powercode NEC2Code PROGMEM = {
  freq_to_timerval(37470),
  { {924,	464},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	57},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	173},
    {58,	4054},
    {926,	230},
    {58,	9880},
    {926,	230},
    {58,	0} }
};

// Code 036 - Hitachi
const struct powercode hitachi4Code PROGMEM = {
  freq_to_timerval(40580),
  { {101,	94},
    {101,	94},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	94},
    {101,	3522},
    {101,	94},
    {101,	94},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	293},
    {101,	94},
    {101,	94},
    {101,	0}
  }
};

// Code 037 - Anam National, Electrohome, GE, Motorola, NEC, Panasonic, 
// Philco, Philips, Quasar, RCA, Tatung
const struct powercode anamCode PROGMEM = {
  freq_to_timerval(36090),
  { {88,	595},
    {88,	255},
    {88,	255},
    {88,	255},
    {88,	594},
    {88,	255},
    {88,	594},
    {88,	594},
    {88,	594},
    {88,	255},
    {88,	0}}
};

// Code 038 - AOC, NEC
const struct powercode aoc2Code PROGMEM = {
  freq_to_timerval(40580),
  { {530,	167},
    {42,	269},
    {42,	269},
    {42,	269},
    {170,	166},
    {42,	269},
    {170,	166},
    {170,	166},
    {42,	269},
    {42,	269},
    {42,	0} }
};

// Code 039 - Candle, Citizen, JC Penney, Magnavox, Philco, Philips, 
// Simpson, Soundesign, Sylvania, Teknika
const struct powercode candleCode PROGMEM = {
  freq_to_timerval(38970),
  { {924,	459},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	57},
    {59,	57},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	57},
    {59,	178},
    {59,	178},
    {59,	178},
    {59,	4262},
    {924,	231},
    {59,	9758},
    {924,	231},
    {59,	0}  
  }
};

// Code 040 - Contec/Cony, Emerson, Goldstar, Hitachi, JVC, Philco,
// Philips, Proton, Radio Shack/Realistic, Samsung, Scott,
// Sharp, Teknika
const struct powercode contecCode PROGMEM = {
  freq_to_timerval(54070),
  { {118,	 103},
    {708,	2778},
    {118,	 103},
    {708,	   0}
  }
};

// Code 041 - Contec/Cony, Hitachi, JC Penney, JVC, Sears, Teknika
const struct powercode contec2Code PROGMEM = {
  freq_to_timerval(38970),
  { {118,	 103},
    {118,	 103},
    {118,	 205},
    {118,	2778},
    {118,	 103},
    {118,	 103},
    {118,	 205},
    {118,	   0}
  }
};

// Code 042 - Sony
const struct powercode sony3Code PROGMEM = {
  freq_to_timerval(74940),
  { {250,	  63},
    {121,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    { 60,	  63},
    { 60,	  63},
    { 60,	2819},
    {250,	  63},
    {121,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    { 60,	  63},
    {121,	  63},
    { 60,	  63},
    { 60,	  63},
    { 60,	  63},
    { 60,	   0}
  }
};

// Code 043 - Alleron, Emerson, Fujitsu, Funai, Grunpy, Scott, Sears, 
// Soundesign, Teknika, Wards

const struct powercode alleronCode PROGMEM = {
  freq_to_timerval(38970),
  { {924,	 431},
    { 56,	 173},
    { 56,	 173},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	 173},
    { 56,	  66},
    { 56,	 173},
    { 56,	  66},
    { 56,	 173},
    { 56,	 173},
    { 56,	 173},
    { 56,	 173},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	 173},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	  66},
    { 56,	 173},
    { 56,	 173},
    { 56,	 173},
    { 56,	  66},
    { 56,	 173},
    { 56,	 173},
    { 56,	 173},
    { 56,	 173},
    { 56,	4208},
    {924,	 231},
    { 56,	8899},
    {924,	 231},
    { 56,	   0}
  }
};

// Code 044 - Contec/Cony, Hitachi, JVC, Sears, Teknika

const struct powercode contec3Code PROGMEM = {
  freq_to_timerval(39010),
  { { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    {136,	  45},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	3583},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    {136,	  45},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	 123},
    { 46,	   0}
  }
};

/*
// Code 045 - Curtis Mathes, Samsung
const struct powercode curtisCode PROGMEM = {
  freq_to_timerval(38970),
  { {444,	 446},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	  51},
    { 54,	 163},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	  51},
    { 54,	 163},
    { 54,	  51},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	 163},
    { 54,	4204},
    {908,	 224},
    { 54,	9767},
    {908,	 224},
    { 54,	   0}
  }
};

// Code 046 - Aiko, Citizen, Daewoo, Nikko, NTC, Portland, Teknika
const struct powercode aikoCode PROGMEM = {
  freq_to_timerval(37470),
  { {470,	 459},
    { 61,	  53},
    { 61,	 170},
    { 61,	 170},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	 170},
    { 61,	 170},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	 170},
    { 61,	 170},
    { 61,	 170},
    { 61,	 170},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	  53},
    { 61,	 170},
    { 61,	 170},
    { 61,	 170},
    { 61,	 170},
    { 61,	4612},
    {470,	 459},
    { 61,	 170},
    { 61,	9937},
    {470,	 459},
    { 61,	 170},
    { 61,	   0}
  }
};

// Code 047 - Daewoo
const struct powercode daewoo2Code PROGMEM = {
  freq_to_timerval(28670),
  { { 56,	  282},
    { 56,	  106},
    {108,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	 2592},
    { 56,	  282},
    { 56,	  106},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	13150},
    { 56,	  282},
    { 56,	  106},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	   52},
    { 56,	    0}
  }
};

// Code 048 - Electrohome, GE, JC Penney, MGA, Mitsubishi
const struct powercode electrohomeCode PROGMEM = {
  freq_to_timerval(38970),
  { {924,	  459},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	 4260},
    {924,	  231},
    { 59,	 9752},
    {924,	  231},
    { 59,	    0}
  }
};

// Code 049 - Emerson, Sharp
const struct powercode emersonCode PROGMEM = {
  freq_to_timerval(38970),
  { {444,	  446},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	   51},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	  163},
    { 54,	 4204},
    {908,	  224},
    { 54,	 9767},
    {908,	  224},
    { 54,	    0}
  }
};
*/

// Code 050 - Fisher, MGA, Mitsubishi, Sears
const struct powercode fisherCode PROGMEM = {
  freq_to_timerval(44330),
  { {282,	 876},
    {282,	2038},
    {282,	2038},
    {282,	 876},
    {282,	 876},
    {282,	2038},
    {282,	 876},
    {282,	2038},
    {282,	2038},
    {282,	 876},
    {282,	   0}
  }
};

/*
// Code 051 - Amplivision, Atlantic, Clatronic, Condor, Desnet, Formenti, 
// Hanseatic, Korting, Manesth, NEC, Orion, Otto Versand, 
// Pathe Cinema, Perdio, Phoenix, Sogera, Soundwave, Standard, 
// Technema, Telemeister, Televideon, Tensai, Tenson, Uher,
// Videotechnic, Vision, Watson, Weltblick, White Westinghouse

const struct powercode amplivisionCode PROGMEM = {
  freq_to_timerval(8860),
  { {  3,	   29},
    { 71,	   19},
    { 48,	   29},
    {  3,	13072},
    {  3,	   29},
    { 14,	   19},
    {  3,	   19},
    {  3,	   19},
    {  3,	   19},
    { 14,	   19},
    { 48,	   29},
    {  3,	    0}
  }
};

// Code 052 - GE, JC Penney, JVC, Midland, Panasonic, Prism, Quasar, 
// Techics, Techwood
const struct powercode geCode PROGMEM = {
  freq_to_timerval(54160),
  { {369,	  339},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	   89},
    { 83,	 3849},
    {369,	  339},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	   89},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	  260},
    { 83,	   89},
    { 83,	    0}
  }
};

// Code 053 - JVC
const struct powercode jvc2Code PROGMEM = {
  freq_to_timerval(38970),
  { {924,	  459},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 58,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 58,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	 4260},
    {924,	  231},
    { 59,	 9752},
    {924,	  231},
    { 59,	    0}
  }
};

// Code 054 - JVC
const struct powercode jvc3Code PROGMEM = {
  freq_to_timerval(38970),
  { {924,	  459},
    { 59,	  178},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	   57},
    { 59,	   57},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 59,	   57},
    { 59,	  178},
    { 59,	  178},
    { 58,	  178},
    { 59,	 4260},
    {924,	  231},
    { 59,	 9752},
    {924,	  231},
    { 59,	    0}
  }
};

// Code 055 - Kloss Novabeam, Magnavox, Philco, Philips, Sylvania, Wards
const struct powercode klossCode PROGMEM = {
  freq_to_timerval(54070),
  { { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  524},
    { 53,	  524},
    { 53,	  237},
    { 53,	  237},
    { 53,	  237},
    { 53,	  237},
    { 53,	  524},
    { 53,	 2959},
    { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  812},
    { 53,	  237},
    { 53,	  524},
    { 53,	  524},
    { 53,	  237},
    { 53,	  237},
    { 53,	  237},
    { 53,	  237},
    { 53,	  524},
    { 53,	    0}
  }
};
*/


const PGM_P *powerCodes[] PROGMEM  = {
  &sonyCode, &rcaCode, &panasonicCode, &sharpCode, &toshibaCode,
  &philipsCode, &samsungCode,&zenithCode, &pioneerCode, &sylvaniaCode,
  &jvcCode, &hitachiCode, &sampoCode, &hisenseCode, &viewsonicCode,
  &bushCode, &aocCode, &bellCode, &pioneer2Code, &fujitsuCode,
  &goldstarCode, &daewooCode, &NECCode, &admiralCode, &sony2Code,
  &viewsonic2Code, &zenith2Code, &thompsonCode, &brillianCode, &magnavoxCode,
  &viewsonic3Code, &crownCode, &hitachi2Code, &fujitsu2Code, &hitachi3Code,
  &NEC2Code, &hitachi4Code, &anamCode, &aoc2Code, &candleCode,
  &contecCode, &contec2Code, &sony3Code, &alleronCode, &contec3Code, 
  &fisherCode
};


uint8_t num_codes = (sizeof(powerCodes)/sizeof(*powerCodes));
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: Hjälp att fatta AVR kod!

Inlägg av sodjan »

Jaha, det står ju där, på raderna som börjar med
"The next read from the powerCode..."
och "Subsequent reads from the powerCode...".
Användarvisningsbild
ghost_rider
Inlägg: 2211
Blev medlem: 26 maj 2008, 21:48:15
Ort: Genarp

Re: Hjälp att fatta AVR kod!

Inlägg av ghost_rider »

är det inte så att den skickar ut en massa 'avstängnings koder' på en frekvens, och sedan med lite tur så råkar din tv o en kod matcha så att tv¨n stängs av.?
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: Hjälp att fatta AVR kod!

Inlägg av sodjan »

Jo, visst gör den det :-)
Men jag tolkade det som att ElectricMan redan visste vad en "TV-B gone" är... :-)
Användarvisningsbild
vfr
EF Sponsor
Inlägg: 3515
Blev medlem: 31 mars 2005, 17:55:45
Ort: Kungsbacka

Re: Hjälp att fatta AVR kod!

Inlägg av vfr »

Absolut!

Det verkar ju som att koden skickar in tabellen i funktionen "freq_to_timerval". Kolla vad den gör så får du svaret. Det är säkert definitioner av pulstider och pulsluckor i någon form. På vilket sätt, ska framgå av dokumentationen för funktionen.
sodjan
EF Sponsor
Inlägg: 43251
Blev medlem: 10 maj 2005, 16:29:20
Ort: Söderköping

Re: Hjälp att fatta AVR kod!

Inlägg av sodjan »

> Det är säkert definitioner av pulstider och pulsluckor i någon form.

Ja, alltså, det stog ju i den del av koden som postades här några inlägg sedan
så, visst, det är det säkert... :-)
bos
Inlägg: 2314
Blev medlem: 24 februari 2007, 23:29:15
Kontakt:

Re: Hjälp att fatta AVR kod!

Inlägg av bos »

ElectricMan skrev:Då kom jag att tänka på om man kan konvertera den till Arduino språket som jag fattar!
Vad är "Arduino språket"?
Användarvisningsbild
ghost_rider
Inlägg: 2211
Blev medlem: 26 maj 2008, 21:48:15
Ort: Genarp

Re: Hjälp att fatta AVR kod!

Inlägg av ghost_rider »

java wannabe :)
Användarvisningsbild
adent
Inlägg: 4250
Blev medlem: 27 november 2008, 22:56:23
Ort: Utanför Jönköping
Kontakt:

Re: Hjälp att fatta AVR kod!

Inlägg av adent »

Arduino är väl C? med lite hjälpfunktioner?
Användarvisningsbild
Glenn
Inlägg: 36772
Blev medlem: 24 februari 2006, 12:01:56
Ort: Norr om Sthlm
Kontakt:

Re: Hjälp att fatta AVR kod!

Inlägg av Glenn »

www.auduino.cc skrev: Can I program the Arduino board in C?

In fact, you already are; the Arduino language is merely a set of C/C++ functions that can be called from your code. Your sketch undergoes minor changes (e.g. automatic generation of function prototypes) and then is passed directly to a C/C++ compiler (avr-g++). All standard C and C++ constructs supported by avr-g++ should work in Arduino. For more details, see the page on the Arduino build process.
:)
Användarvisningsbild
jadler
EF Sponsor
Inlägg: 407
Blev medlem: 28 maj 2009, 12:03:43
Ort: Vidja, Huddinge, Stockholm
Kontakt:

Re: Hjälp att fatta AVR kod!

Inlägg av jadler »

Kod: Markera allt

// This function transmits one Code Element of a POWER code to the IR emitter,
//   given offTime and onTime for the codeElement
//     If offTime = 0 that signifies the last Code Element of the POWER code
//     and the delay_ten_us function will have no delay for offTime
//     (but we'll delay for 250 milliseconds in the main function)
void xmitCodeElement(uint16_t ontime, uint16_t offtime ) {
Kodtabellen innehåller alltså tiderna som IR-dioden skall lysa respektive vara släckt.

Programmet som Limor skrev är i princip Arduino-kod, det är C för AVR, i detta fall var det väl en ATtiny 84. Korrigerar du namn på olika register och bitar så borde det kunna fungera på en Arduino också. Du måste nog använda hårdvarumanipulerande kod för att få detta gjort, så det är inte säkert att det blir så väldigt mycket mer lättläst. Läser du databladet för den MCU hon skrev för så bör du nog kunna greppa vad programmet gör, men jag erkänner att det inte alltid är helt trivialt.
Skriv svar